Class ExperimentServiceClient
- java.lang.Object
-
- com.google.ads.googleads.v10.services.ExperimentServiceClient
-
- All Implemented Interfaces:
com.google.api.gax.core.BackgroundResource,java.lang.AutoCloseable
@Generated("by gapic-generator-java") public class ExperimentServiceClient extends java.lang.Object implements com.google.api.gax.core.BackgroundResourceService Description: Service to manage experiments.This class provides the ability to make remote calls to the backing service through method calls that map to API methods. Sample code to get started:
try (ExperimentServiceClient experimentServiceClient = ExperimentServiceClient.create()) { String customerId = "customerId-1581184615"; List<ExperimentOperation> operations = new ArrayList<>(); MutateExperimentsResponse response = experimentServiceClient.mutateExperiments(customerId, operations); }Note: close() needs to be called on the ExperimentServiceClient object to clean up resources such as threads. In the example above, try-with-resources is used, which automatically calls close().
The surface of this class includes several types of Java methods for each of the API's methods:
- A "flattened" method. With this type of method, the fields of the request type have been converted into function parameters. It may be the case that not all fields are available as parameters, and not every API method will have a flattened method entry point.
- A "request object" method. This type of method only takes one parameter, a request object, which must be constructed before the call. Not every API method will have a request object method.
- A "callable" method. This type of method takes no parameters and returns an immutable API callable object, which can be used to initiate calls to the service.
See the individual methods for example code.
Many parameters require resource names to be formatted in a particular way. To assist with these names, this class includes a format method for each type of name, and additionally a parse method to extract the individual identifiers contained within names that are returned.
This class can be customized by passing in a custom instance of ExperimentServiceSettings to create(). For example:
To customize credentials:
ExperimentServiceSettings experimentServiceSettings = ExperimentServiceSettings.newBuilder() .setCredentialsProvider(FixedCredentialsProvider.create(myCredentials)) .build(); ExperimentServiceClient experimentServiceClient = ExperimentServiceClient.create(experimentServiceSettings);To customize the endpoint:
ExperimentServiceSettings experimentServiceSettings = ExperimentServiceSettings.newBuilder().setEndpoint(myEndpoint).build(); ExperimentServiceClient experimentServiceClient = ExperimentServiceClient.create(experimentServiceSettings);Please refer to the GitHub repository's samples for more quickstart code snippets.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classExperimentServiceClient.ListExperimentAsyncErrorsFixedSizeCollectionstatic classExperimentServiceClient.ListExperimentAsyncErrorsPagestatic classExperimentServiceClient.ListExperimentAsyncErrorsPagedResponse
-
Constructor Summary
Constructors Modifier Constructor Description protectedExperimentServiceClient(ExperimentServiceSettings settings)Constructs an instance of ExperimentServiceClient, using the given settings.protectedExperimentServiceClient(ExperimentServiceStub stub)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description booleanawaitTermination(long duration, java.util.concurrent.TimeUnit unit)voidclose()static ExperimentServiceClientcreate()Constructs an instance of ExperimentServiceClient with default settings.static ExperimentServiceClientcreate(ExperimentServiceSettings settings)Constructs an instance of ExperimentServiceClient, using the given settings.static ExperimentServiceClientcreate(ExperimentServiceStub stub)Constructs an instance of ExperimentServiceClient, using the given stub for making calls.voidendExperiment(ExperimentName experiment)Immediately ends an experiment, changing the experiment's scheduled end date and without waiting for end of day.voidendExperiment(EndExperimentRequest request)Immediately ends an experiment, changing the experiment's scheduled end date and without waiting for end of day.voidendExperiment(java.lang.String experiment)Immediately ends an experiment, changing the experiment's scheduled end date and without waiting for end of day.com.google.api.gax.rpc.UnaryCallable<EndExperimentRequest,com.google.protobuf.Empty>endExperimentCallable()Immediately ends an experiment, changing the experiment's scheduled end date and without waiting for end of day.com.google.longrunning.OperationsClientgetOperationsClient()Returns the OperationsClient that can be used to query the status of a long-running operation returned by another API method call.ExperimentServiceSettingsgetSettings()ExperimentServiceStubgetStub()voidgraduateExperiment(ExperimentName experiment, java.util.List<CampaignBudgetMapping> campaignBudgetMappings)Graduates an experiment to a full campaign.voidgraduateExperiment(GraduateExperimentRequest request)Graduates an experiment to a full campaign.voidgraduateExperiment(java.lang.String experiment, java.util.List<CampaignBudgetMapping> campaignBudgetMappings)Graduates an experiment to a full campaign.com.google.api.gax.rpc.UnaryCallable<GraduateExperimentRequest,com.google.protobuf.Empty>graduateExperimentCallable()Graduates an experiment to a full campaign.booleanisShutdown()booleanisTerminated()ExperimentServiceClient.ListExperimentAsyncErrorsPagedResponselistExperimentAsyncErrors(ExperimentName resourceName)Returns all errors that occurred during the last Experiment update (either scheduling or promotion).ExperimentServiceClient.ListExperimentAsyncErrorsPagedResponselistExperimentAsyncErrors(ListExperimentAsyncErrorsRequest request)Returns all errors that occurred during the last Experiment update (either scheduling or promotion).ExperimentServiceClient.ListExperimentAsyncErrorsPagedResponselistExperimentAsyncErrors(java.lang.String resourceName)Returns all errors that occurred during the last Experiment update (either scheduling or promotion).com.google.api.gax.rpc.UnaryCallable<ListExperimentAsyncErrorsRequest,ListExperimentAsyncErrorsResponse>listExperimentAsyncErrorsCallable()Returns all errors that occurred during the last Experiment update (either scheduling or promotion).com.google.api.gax.rpc.UnaryCallable<ListExperimentAsyncErrorsRequest,ExperimentServiceClient.ListExperimentAsyncErrorsPagedResponse>listExperimentAsyncErrorsPagedCallable()Returns all errors that occurred during the last Experiment update (either scheduling or promotion).MutateExperimentsResponsemutateExperiments(MutateExperimentsRequest request)Creates, updates, or removes experiments.MutateExperimentsResponsemutateExperiments(java.lang.String customerId, java.util.List<ExperimentOperation> operations)Creates, updates, or removes experiments.com.google.api.gax.rpc.UnaryCallable<MutateExperimentsRequest,MutateExperimentsResponse>mutateExperimentsCallable()Creates, updates, or removes experiments.com.google.api.gax.longrunning.OperationFuture<com.google.protobuf.Empty,PromoteExperimentMetadata>promoteExperimentAsync(ExperimentName resourceName)Promotes the trial campaign thus applying changes in the trial campaign to the base campaign.com.google.api.gax.longrunning.OperationFuture<com.google.protobuf.Empty,PromoteExperimentMetadata>promoteExperimentAsync(PromoteExperimentRequest request)Promotes the trial campaign thus applying changes in the trial campaign to the base campaign.com.google.api.gax.longrunning.OperationFuture<com.google.protobuf.Empty,PromoteExperimentMetadata>promoteExperimentAsync(java.lang.String resourceName)Promotes the trial campaign thus applying changes in the trial campaign to the base campaign.com.google.api.gax.rpc.UnaryCallable<PromoteExperimentRequest,com.google.longrunning.Operation>promoteExperimentCallable()Promotes the trial campaign thus applying changes in the trial campaign to the base campaign.com.google.api.gax.rpc.OperationCallable<PromoteExperimentRequest,com.google.protobuf.Empty,PromoteExperimentMetadata>promoteExperimentOperationCallable()Promotes the trial campaign thus applying changes in the trial campaign to the base campaign.com.google.api.gax.longrunning.OperationFuture<com.google.protobuf.Empty,ScheduleExperimentMetadata>scheduleExperimentAsync(ExperimentName resourceName)Schedule an experiment.com.google.api.gax.longrunning.OperationFuture<com.google.protobuf.Empty,ScheduleExperimentMetadata>scheduleExperimentAsync(ScheduleExperimentRequest request)Schedule an experiment.com.google.api.gax.longrunning.OperationFuture<com.google.protobuf.Empty,ScheduleExperimentMetadata>scheduleExperimentAsync(java.lang.String resourceName)Schedule an experiment.com.google.api.gax.rpc.UnaryCallable<ScheduleExperimentRequest,com.google.longrunning.Operation>scheduleExperimentCallable()Schedule an experiment.com.google.api.gax.rpc.OperationCallable<ScheduleExperimentRequest,com.google.protobuf.Empty,ScheduleExperimentMetadata>scheduleExperimentOperationCallable()Schedule an experiment.voidshutdown()voidshutdownNow()
-
-
-
Constructor Detail
-
ExperimentServiceClient
protected ExperimentServiceClient(ExperimentServiceSettings settings) throws java.io.IOException
Constructs an instance of ExperimentServiceClient, using the given settings. This is protected so that it is easy to make a subclass, but otherwise, the static factory methods should be preferred.- Throws:
java.io.IOException
-
ExperimentServiceClient
@BetaApi("A restructuring of stub classes is planned, so this may break in the future") protected ExperimentServiceClient(ExperimentServiceStub stub)
-
-
Method Detail
-
create
public static final ExperimentServiceClient create() throws java.io.IOException
Constructs an instance of ExperimentServiceClient with default settings.- Throws:
java.io.IOException
-
create
public static final ExperimentServiceClient create(ExperimentServiceSettings settings) throws java.io.IOException
Constructs an instance of ExperimentServiceClient, using the given settings. The channels are created based on the settings passed in, or defaults for any settings that are not set.- Throws:
java.io.IOException
-
create
@BetaApi("A restructuring of stub classes is planned, so this may break in the future") public static final ExperimentServiceClient create(ExperimentServiceStub stub)Constructs an instance of ExperimentServiceClient, using the given stub for making calls. This is for advanced usage - prefer using create(ExperimentServiceSettings).
-
getSettings
public final ExperimentServiceSettings getSettings()
-
getStub
@BetaApi("A restructuring of stub classes is planned, so this may break in the future") public ExperimentServiceStub getStub()
-
getOperationsClient
public final com.google.longrunning.OperationsClient getOperationsClient()
Returns the OperationsClient that can be used to query the status of a long-running operation returned by another API method call.
-
mutateExperiments
public final MutateExperimentsResponse mutateExperiments(java.lang.String customerId, java.util.List<ExperimentOperation> operations)
Creates, updates, or removes experiments. Operation statuses are returned.List of thrown errors: [AuthenticationError]() [AuthorizationError]() [ExperimentError]() [HeaderError]() [InternalError]() [QuotaError]() [RequestError]()
Sample code:
try (ExperimentServiceClient experimentServiceClient = ExperimentServiceClient.create()) { String customerId = "customerId-1581184615"; List<ExperimentOperation> operations = new ArrayList<>(); MutateExperimentsResponse response = experimentServiceClient.mutateExperiments(customerId, operations); }- Parameters:
customerId- Required. The ID of the customer whose experiments are being modified.operations- Required. The list of operations to perform on individual experiments.- Throws:
com.google.api.gax.rpc.ApiException- if the remote call fails
-
mutateExperiments
public final MutateExperimentsResponse mutateExperiments(MutateExperimentsRequest request)
Creates, updates, or removes experiments. Operation statuses are returned.List of thrown errors: [AuthenticationError]() [AuthorizationError]() [ExperimentError]() [HeaderError]() [InternalError]() [QuotaError]() [RequestError]()
Sample code:
try (ExperimentServiceClient experimentServiceClient = ExperimentServiceClient.create()) { MutateExperimentsRequest request = MutateExperimentsRequest.newBuilder() .setCustomerId("customerId-1581184615") .addAllOperations(new ArrayList<ExperimentOperation>()) .setPartialFailure(true) .setValidateOnly(true) .build(); MutateExperimentsResponse response = experimentServiceClient.mutateExperiments(request); }- Parameters:
request- The request object containing all of the parameters for the API call.- Throws:
com.google.api.gax.rpc.ApiException- if the remote call fails
-
mutateExperimentsCallable
public final com.google.api.gax.rpc.UnaryCallable<MutateExperimentsRequest,MutateExperimentsResponse> mutateExperimentsCallable()
Creates, updates, or removes experiments. Operation statuses are returned.List of thrown errors: [AuthenticationError]() [AuthorizationError]() [ExperimentError]() [HeaderError]() [InternalError]() [QuotaError]() [RequestError]()
Sample code:
try (ExperimentServiceClient experimentServiceClient = ExperimentServiceClient.create()) { MutateExperimentsRequest request = MutateExperimentsRequest.newBuilder() .setCustomerId("customerId-1581184615") .addAllOperations(new ArrayList<ExperimentOperation>()) .setPartialFailure(true) .setValidateOnly(true) .build(); ApiFuture<MutateExperimentsResponse> future = experimentServiceClient.mutateExperimentsCallable().futureCall(request); // Do something. MutateExperimentsResponse response = future.get(); }
-
endExperiment
public final void endExperiment(ExperimentName experiment)
Immediately ends an experiment, changing the experiment's scheduled end date and without waiting for end of day. End date is updated to be the time of the request.List of thrown errors: [AuthenticationError]() [AuthorizationError]() [ExperimentError]() [HeaderError]() [InternalError]() [QuotaError]() [RequestError]()
Sample code:
try (ExperimentServiceClient experimentServiceClient = ExperimentServiceClient.create()) { ExperimentName experiment = ExperimentName.of("[CUSTOMER_ID]", "[TRIAL_ID]"); experimentServiceClient.endExperiment(experiment); }- Parameters:
experiment- Required. The resource name of the campaign experiment to end.- Throws:
com.google.api.gax.rpc.ApiException- if the remote call fails
-
endExperiment
public final void endExperiment(java.lang.String experiment)
Immediately ends an experiment, changing the experiment's scheduled end date and without waiting for end of day. End date is updated to be the time of the request.List of thrown errors: [AuthenticationError]() [AuthorizationError]() [ExperimentError]() [HeaderError]() [InternalError]() [QuotaError]() [RequestError]()
Sample code:
try (ExperimentServiceClient experimentServiceClient = ExperimentServiceClient.create()) { String experiment = ExperimentName.of("[CUSTOMER_ID]", "[TRIAL_ID]").toString(); experimentServiceClient.endExperiment(experiment); }- Parameters:
experiment- Required. The resource name of the campaign experiment to end.- Throws:
com.google.api.gax.rpc.ApiException- if the remote call fails
-
endExperiment
public final void endExperiment(EndExperimentRequest request)
Immediately ends an experiment, changing the experiment's scheduled end date and without waiting for end of day. End date is updated to be the time of the request.List of thrown errors: [AuthenticationError]() [AuthorizationError]() [ExperimentError]() [HeaderError]() [InternalError]() [QuotaError]() [RequestError]()
Sample code:
try (ExperimentServiceClient experimentServiceClient = ExperimentServiceClient.create()) { EndExperimentRequest request = EndExperimentRequest.newBuilder() .setExperiment(ExperimentName.of("[CUSTOMER_ID]", "[TRIAL_ID]").toString()) .setValidateOnly(true) .build(); experimentServiceClient.endExperiment(request); }- Parameters:
request- The request object containing all of the parameters for the API call.- Throws:
com.google.api.gax.rpc.ApiException- if the remote call fails
-
endExperimentCallable
public final com.google.api.gax.rpc.UnaryCallable<EndExperimentRequest,com.google.protobuf.Empty> endExperimentCallable()
Immediately ends an experiment, changing the experiment's scheduled end date and without waiting for end of day. End date is updated to be the time of the request.List of thrown errors: [AuthenticationError]() [AuthorizationError]() [ExperimentError]() [HeaderError]() [InternalError]() [QuotaError]() [RequestError]()
Sample code:
try (ExperimentServiceClient experimentServiceClient = ExperimentServiceClient.create()) { EndExperimentRequest request = EndExperimentRequest.newBuilder() .setExperiment(ExperimentName.of("[CUSTOMER_ID]", "[TRIAL_ID]").toString()) .setValidateOnly(true) .build(); ApiFuture<Empty> future = experimentServiceClient.endExperimentCallable().futureCall(request); // Do something. future.get(); }
-
listExperimentAsyncErrors
public final ExperimentServiceClient.ListExperimentAsyncErrorsPagedResponse listExperimentAsyncErrors(ExperimentName resourceName)
Returns all errors that occurred during the last Experiment update (either scheduling or promotion). Supports standard list paging.List of thrown errors: [AuthenticationError]() [AuthorizationError]() [HeaderError]() [InternalError]() [QuotaError]() [RequestError]()
Sample code:
try (ExperimentServiceClient experimentServiceClient = ExperimentServiceClient.create()) { ExperimentName resourceName = ExperimentName.of("[CUSTOMER_ID]", "[TRIAL_ID]"); for (Status element : experimentServiceClient.listExperimentAsyncErrors(resourceName).iterateAll()) { // doThingsWith(element); } }- Parameters:
resourceName- Required. The name of the experiment from which to retrieve the async errors.- Throws:
com.google.api.gax.rpc.ApiException- if the remote call fails
-
listExperimentAsyncErrors
public final ExperimentServiceClient.ListExperimentAsyncErrorsPagedResponse listExperimentAsyncErrors(java.lang.String resourceName)
Returns all errors that occurred during the last Experiment update (either scheduling or promotion). Supports standard list paging.List of thrown errors: [AuthenticationError]() [AuthorizationError]() [HeaderError]() [InternalError]() [QuotaError]() [RequestError]()
Sample code:
try (ExperimentServiceClient experimentServiceClient = ExperimentServiceClient.create()) { String resourceName = ExperimentName.of("[CUSTOMER_ID]", "[TRIAL_ID]").toString(); for (Status element : experimentServiceClient.listExperimentAsyncErrors(resourceName).iterateAll()) { // doThingsWith(element); } }- Parameters:
resourceName- Required. The name of the experiment from which to retrieve the async errors.- Throws:
com.google.api.gax.rpc.ApiException- if the remote call fails
-
listExperimentAsyncErrors
public final ExperimentServiceClient.ListExperimentAsyncErrorsPagedResponse listExperimentAsyncErrors(ListExperimentAsyncErrorsRequest request)
Returns all errors that occurred during the last Experiment update (either scheduling or promotion). Supports standard list paging.List of thrown errors: [AuthenticationError]() [AuthorizationError]() [HeaderError]() [InternalError]() [QuotaError]() [RequestError]()
Sample code:
try (ExperimentServiceClient experimentServiceClient = ExperimentServiceClient.create()) { ListExperimentAsyncErrorsRequest request = ListExperimentAsyncErrorsRequest.newBuilder() .setResourceName(ExperimentName.of("[CUSTOMER_ID]", "[TRIAL_ID]").toString()) .setPageToken("pageToken873572522") .setPageSize(883849137) .build(); for (Status element : experimentServiceClient.listExperimentAsyncErrors(request).iterateAll()) { // doThingsWith(element); } }- Parameters:
request- The request object containing all of the parameters for the API call.- Throws:
com.google.api.gax.rpc.ApiException- if the remote call fails
-
listExperimentAsyncErrorsPagedCallable
public final com.google.api.gax.rpc.UnaryCallable<ListExperimentAsyncErrorsRequest,ExperimentServiceClient.ListExperimentAsyncErrorsPagedResponse> listExperimentAsyncErrorsPagedCallable()
Returns all errors that occurred during the last Experiment update (either scheduling or promotion). Supports standard list paging.List of thrown errors: [AuthenticationError]() [AuthorizationError]() [HeaderError]() [InternalError]() [QuotaError]() [RequestError]()
Sample code:
try (ExperimentServiceClient experimentServiceClient = ExperimentServiceClient.create()) { ListExperimentAsyncErrorsRequest request = ListExperimentAsyncErrorsRequest.newBuilder() .setResourceName(ExperimentName.of("[CUSTOMER_ID]", "[TRIAL_ID]").toString()) .setPageToken("pageToken873572522") .setPageSize(883849137) .build(); ApiFuture<Status> future = experimentServiceClient.listExperimentAsyncErrorsPagedCallable().futureCall(request); // Do something. for (Status element : future.get().iterateAll()) { // doThingsWith(element); } }
-
listExperimentAsyncErrorsCallable
public final com.google.api.gax.rpc.UnaryCallable<ListExperimentAsyncErrorsRequest,ListExperimentAsyncErrorsResponse> listExperimentAsyncErrorsCallable()
Returns all errors that occurred during the last Experiment update (either scheduling or promotion). Supports standard list paging.List of thrown errors: [AuthenticationError]() [AuthorizationError]() [HeaderError]() [InternalError]() [QuotaError]() [RequestError]()
Sample code:
try (ExperimentServiceClient experimentServiceClient = ExperimentServiceClient.create()) { ListExperimentAsyncErrorsRequest request = ListExperimentAsyncErrorsRequest.newBuilder() .setResourceName(ExperimentName.of("[CUSTOMER_ID]", "[TRIAL_ID]").toString()) .setPageToken("pageToken873572522") .setPageSize(883849137) .build(); while (true) { ListExperimentAsyncErrorsResponse response = experimentServiceClient.listExperimentAsyncErrorsCallable().call(request); for (Status element : response.getResponsesList()) { // doThingsWith(element); } String nextPageToken = response.getNextPageToken(); if (!Strings.isNullOrEmpty(nextPageToken)) { request = request.toBuilder().setPageToken(nextPageToken).build(); } else { break; } } }
-
graduateExperiment
public final void graduateExperiment(ExperimentName experiment, java.util.List<CampaignBudgetMapping> campaignBudgetMappings)
Graduates an experiment to a full campaign.List of thrown errors: [AuthenticationError]() [AuthorizationError]() [ExperimentError]() [HeaderError]() [InternalError]() [MutateError]() [QuotaError]() [RequestError]()
Sample code:
try (ExperimentServiceClient experimentServiceClient = ExperimentServiceClient.create()) { ExperimentName experiment = ExperimentName.of("[CUSTOMER_ID]", "[TRIAL_ID]"); List<CampaignBudgetMapping> campaignBudgetMappings = new ArrayList<>(); experimentServiceClient.graduateExperiment(experiment, campaignBudgetMappings); }- Parameters:
experiment- Required. The experiment to be graduated.campaignBudgetMappings- Required. List of campaign budget mappings for graduation. Each campaign that appears here will graduate, and will be assigned a new budget that is paired with it in the mapping. The maximum size is one.- Throws:
com.google.api.gax.rpc.ApiException- if the remote call fails
-
graduateExperiment
public final void graduateExperiment(java.lang.String experiment, java.util.List<CampaignBudgetMapping> campaignBudgetMappings)Graduates an experiment to a full campaign.List of thrown errors: [AuthenticationError]() [AuthorizationError]() [ExperimentError]() [HeaderError]() [InternalError]() [MutateError]() [QuotaError]() [RequestError]()
Sample code:
try (ExperimentServiceClient experimentServiceClient = ExperimentServiceClient.create()) { String experiment = ExperimentName.of("[CUSTOMER_ID]", "[TRIAL_ID]").toString(); List<CampaignBudgetMapping> campaignBudgetMappings = new ArrayList<>(); experimentServiceClient.graduateExperiment(experiment, campaignBudgetMappings); }- Parameters:
experiment- Required. The experiment to be graduated.campaignBudgetMappings- Required. List of campaign budget mappings for graduation. Each campaign that appears here will graduate, and will be assigned a new budget that is paired with it in the mapping. The maximum size is one.- Throws:
com.google.api.gax.rpc.ApiException- if the remote call fails
-
graduateExperiment
public final void graduateExperiment(GraduateExperimentRequest request)
Graduates an experiment to a full campaign.List of thrown errors: [AuthenticationError]() [AuthorizationError]() [ExperimentError]() [HeaderError]() [InternalError]() [MutateError]() [QuotaError]() [RequestError]()
Sample code:
try (ExperimentServiceClient experimentServiceClient = ExperimentServiceClient.create()) { GraduateExperimentRequest request = GraduateExperimentRequest.newBuilder() .setExperiment(ExperimentName.of("[CUSTOMER_ID]", "[TRIAL_ID]").toString()) .addAllCampaignBudgetMappings(new ArrayList<CampaignBudgetMapping>()) .setValidateOnly(true) .build(); experimentServiceClient.graduateExperiment(request); }- Parameters:
request- The request object containing all of the parameters for the API call.- Throws:
com.google.api.gax.rpc.ApiException- if the remote call fails
-
graduateExperimentCallable
public final com.google.api.gax.rpc.UnaryCallable<GraduateExperimentRequest,com.google.protobuf.Empty> graduateExperimentCallable()
Graduates an experiment to a full campaign.List of thrown errors: [AuthenticationError]() [AuthorizationError]() [ExperimentError]() [HeaderError]() [InternalError]() [MutateError]() [QuotaError]() [RequestError]()
Sample code:
try (ExperimentServiceClient experimentServiceClient = ExperimentServiceClient.create()) { GraduateExperimentRequest request = GraduateExperimentRequest.newBuilder() .setExperiment(ExperimentName.of("[CUSTOMER_ID]", "[TRIAL_ID]").toString()) .addAllCampaignBudgetMappings(new ArrayList<CampaignBudgetMapping>()) .setValidateOnly(true) .build(); ApiFuture<Empty> future = experimentServiceClient.graduateExperimentCallable().futureCall(request); // Do something. future.get(); }
-
scheduleExperimentAsync
public final com.google.api.gax.longrunning.OperationFuture<com.google.protobuf.Empty,ScheduleExperimentMetadata> scheduleExperimentAsync(ExperimentName resourceName)
Schedule an experiment. The in design campaign will be converted into a real campaign (called the experiment campaign) that will begin serving ads if successfully created.The experiment is scheduled immediately with status INITIALIZING. This method returns a long running operation that tracks the forking of the in design campaign. If the forking fails, a list of errors can be retrieved using the ListExperimentAsyncErrors method. The operation's metadata will be a string containing the resource name of the created experiment.
List of thrown errors: [AuthenticationError]() [AuthorizationError]() [ExperimentError]() [DatabaseError]() [DateError]() [DateRangeError]() [FieldError]() [HeaderError]() [InternalError]() [QuotaError]() [RangeError]() [RequestError]()
Sample code:
try (ExperimentServiceClient experimentServiceClient = ExperimentServiceClient.create()) { ExperimentName resourceName = ExperimentName.of("[CUSTOMER_ID]", "[TRIAL_ID]"); experimentServiceClient.scheduleExperimentAsync(resourceName).get(); }- Parameters:
resourceName- Required. The scheduled experiment.- Throws:
com.google.api.gax.rpc.ApiException- if the remote call fails
-
scheduleExperimentAsync
public final com.google.api.gax.longrunning.OperationFuture<com.google.protobuf.Empty,ScheduleExperimentMetadata> scheduleExperimentAsync(java.lang.String resourceName)
Schedule an experiment. The in design campaign will be converted into a real campaign (called the experiment campaign) that will begin serving ads if successfully created.The experiment is scheduled immediately with status INITIALIZING. This method returns a long running operation that tracks the forking of the in design campaign. If the forking fails, a list of errors can be retrieved using the ListExperimentAsyncErrors method. The operation's metadata will be a string containing the resource name of the created experiment.
List of thrown errors: [AuthenticationError]() [AuthorizationError]() [ExperimentError]() [DatabaseError]() [DateError]() [DateRangeError]() [FieldError]() [HeaderError]() [InternalError]() [QuotaError]() [RangeError]() [RequestError]()
Sample code:
try (ExperimentServiceClient experimentServiceClient = ExperimentServiceClient.create()) { String resourceName = ExperimentName.of("[CUSTOMER_ID]", "[TRIAL_ID]").toString(); experimentServiceClient.scheduleExperimentAsync(resourceName).get(); }- Parameters:
resourceName- Required. The scheduled experiment.- Throws:
com.google.api.gax.rpc.ApiException- if the remote call fails
-
scheduleExperimentAsync
public final com.google.api.gax.longrunning.OperationFuture<com.google.protobuf.Empty,ScheduleExperimentMetadata> scheduleExperimentAsync(ScheduleExperimentRequest request)
Schedule an experiment. The in design campaign will be converted into a real campaign (called the experiment campaign) that will begin serving ads if successfully created.The experiment is scheduled immediately with status INITIALIZING. This method returns a long running operation that tracks the forking of the in design campaign. If the forking fails, a list of errors can be retrieved using the ListExperimentAsyncErrors method. The operation's metadata will be a string containing the resource name of the created experiment.
List of thrown errors: [AuthenticationError]() [AuthorizationError]() [ExperimentError]() [DatabaseError]() [DateError]() [DateRangeError]() [FieldError]() [HeaderError]() [InternalError]() [QuotaError]() [RangeError]() [RequestError]()
Sample code:
try (ExperimentServiceClient experimentServiceClient = ExperimentServiceClient.create()) { ScheduleExperimentRequest request = ScheduleExperimentRequest.newBuilder() .setResourceName(ExperimentName.of("[CUSTOMER_ID]", "[TRIAL_ID]").toString()) .setValidateOnly(true) .build(); experimentServiceClient.scheduleExperimentAsync(request).get(); }- Parameters:
request- The request object containing all of the parameters for the API call.- Throws:
com.google.api.gax.rpc.ApiException- if the remote call fails
-
scheduleExperimentOperationCallable
public final com.google.api.gax.rpc.OperationCallable<ScheduleExperimentRequest,com.google.protobuf.Empty,ScheduleExperimentMetadata> scheduleExperimentOperationCallable()
Schedule an experiment. The in design campaign will be converted into a real campaign (called the experiment campaign) that will begin serving ads if successfully created.The experiment is scheduled immediately with status INITIALIZING. This method returns a long running operation that tracks the forking of the in design campaign. If the forking fails, a list of errors can be retrieved using the ListExperimentAsyncErrors method. The operation's metadata will be a string containing the resource name of the created experiment.
List of thrown errors: [AuthenticationError]() [AuthorizationError]() [ExperimentError]() [DatabaseError]() [DateError]() [DateRangeError]() [FieldError]() [HeaderError]() [InternalError]() [QuotaError]() [RangeError]() [RequestError]()
Sample code:
try (ExperimentServiceClient experimentServiceClient = ExperimentServiceClient.create()) { ScheduleExperimentRequest request = ScheduleExperimentRequest.newBuilder() .setResourceName(ExperimentName.of("[CUSTOMER_ID]", "[TRIAL_ID]").toString()) .setValidateOnly(true) .build(); OperationFuture<Empty, ScheduleExperimentMetadata> future = experimentServiceClient.scheduleExperimentOperationCallable().futureCall(request); // Do something. future.get(); }
-
scheduleExperimentCallable
public final com.google.api.gax.rpc.UnaryCallable<ScheduleExperimentRequest,com.google.longrunning.Operation> scheduleExperimentCallable()
Schedule an experiment. The in design campaign will be converted into a real campaign (called the experiment campaign) that will begin serving ads if successfully created.The experiment is scheduled immediately with status INITIALIZING. This method returns a long running operation that tracks the forking of the in design campaign. If the forking fails, a list of errors can be retrieved using the ListExperimentAsyncErrors method. The operation's metadata will be a string containing the resource name of the created experiment.
List of thrown errors: [AuthenticationError]() [AuthorizationError]() [ExperimentError]() [DatabaseError]() [DateError]() [DateRangeError]() [FieldError]() [HeaderError]() [InternalError]() [QuotaError]() [RangeError]() [RequestError]()
Sample code:
try (ExperimentServiceClient experimentServiceClient = ExperimentServiceClient.create()) { ScheduleExperimentRequest request = ScheduleExperimentRequest.newBuilder() .setResourceName(ExperimentName.of("[CUSTOMER_ID]", "[TRIAL_ID]").toString()) .setValidateOnly(true) .build(); ApiFuture<Operation> future = experimentServiceClient.scheduleExperimentCallable().futureCall(request); // Do something. future.get(); }
-
promoteExperimentAsync
public final com.google.api.gax.longrunning.OperationFuture<com.google.protobuf.Empty,PromoteExperimentMetadata> promoteExperimentAsync(ExperimentName resourceName)
Promotes the trial campaign thus applying changes in the trial campaign to the base campaign. This method returns a long running operation that tracks the promotion of the experiment campaign. If it fails, a list of errors can be retrieved using the ListExperimentAsyncErrors method. The operation's metadata will be a string containing the resource name of the created experiment.List of thrown errors: [AuthenticationError]() [AuthorizationError]() [ExperimentError]() [HeaderError]() [InternalError]() [QuotaError]() [RequestError]()
Sample code:
try (ExperimentServiceClient experimentServiceClient = ExperimentServiceClient.create()) { ExperimentName resourceName = ExperimentName.of("[CUSTOMER_ID]", "[TRIAL_ID]"); experimentServiceClient.promoteExperimentAsync(resourceName).get(); }- Parameters:
resourceName- Required. The resource name of the experiment to promote.- Throws:
com.google.api.gax.rpc.ApiException- if the remote call fails
-
promoteExperimentAsync
public final com.google.api.gax.longrunning.OperationFuture<com.google.protobuf.Empty,PromoteExperimentMetadata> promoteExperimentAsync(java.lang.String resourceName)
Promotes the trial campaign thus applying changes in the trial campaign to the base campaign. This method returns a long running operation that tracks the promotion of the experiment campaign. If it fails, a list of errors can be retrieved using the ListExperimentAsyncErrors method. The operation's metadata will be a string containing the resource name of the created experiment.List of thrown errors: [AuthenticationError]() [AuthorizationError]() [ExperimentError]() [HeaderError]() [InternalError]() [QuotaError]() [RequestError]()
Sample code:
try (ExperimentServiceClient experimentServiceClient = ExperimentServiceClient.create()) { String resourceName = ExperimentName.of("[CUSTOMER_ID]", "[TRIAL_ID]").toString(); experimentServiceClient.promoteExperimentAsync(resourceName).get(); }- Parameters:
resourceName- Required. The resource name of the experiment to promote.- Throws:
com.google.api.gax.rpc.ApiException- if the remote call fails
-
promoteExperimentAsync
public final com.google.api.gax.longrunning.OperationFuture<com.google.protobuf.Empty,PromoteExperimentMetadata> promoteExperimentAsync(PromoteExperimentRequest request)
Promotes the trial campaign thus applying changes in the trial campaign to the base campaign. This method returns a long running operation that tracks the promotion of the experiment campaign. If it fails, a list of errors can be retrieved using the ListExperimentAsyncErrors method. The operation's metadata will be a string containing the resource name of the created experiment.List of thrown errors: [AuthenticationError]() [AuthorizationError]() [ExperimentError]() [HeaderError]() [InternalError]() [QuotaError]() [RequestError]()
Sample code:
try (ExperimentServiceClient experimentServiceClient = ExperimentServiceClient.create()) { PromoteExperimentRequest request = PromoteExperimentRequest.newBuilder() .setResourceName(ExperimentName.of("[CUSTOMER_ID]", "[TRIAL_ID]").toString()) .setValidateOnly(true) .build(); experimentServiceClient.promoteExperimentAsync(request).get(); }- Parameters:
request- The request object containing all of the parameters for the API call.- Throws:
com.google.api.gax.rpc.ApiException- if the remote call fails
-
promoteExperimentOperationCallable
public final com.google.api.gax.rpc.OperationCallable<PromoteExperimentRequest,com.google.protobuf.Empty,PromoteExperimentMetadata> promoteExperimentOperationCallable()
Promotes the trial campaign thus applying changes in the trial campaign to the base campaign. This method returns a long running operation that tracks the promotion of the experiment campaign. If it fails, a list of errors can be retrieved using the ListExperimentAsyncErrors method. The operation's metadata will be a string containing the resource name of the created experiment.List of thrown errors: [AuthenticationError]() [AuthorizationError]() [ExperimentError]() [HeaderError]() [InternalError]() [QuotaError]() [RequestError]()
Sample code:
try (ExperimentServiceClient experimentServiceClient = ExperimentServiceClient.create()) { PromoteExperimentRequest request = PromoteExperimentRequest.newBuilder() .setResourceName(ExperimentName.of("[CUSTOMER_ID]", "[TRIAL_ID]").toString()) .setValidateOnly(true) .build(); OperationFuture<Empty, PromoteExperimentMetadata> future = experimentServiceClient.promoteExperimentOperationCallable().futureCall(request); // Do something. future.get(); }
-
promoteExperimentCallable
public final com.google.api.gax.rpc.UnaryCallable<PromoteExperimentRequest,com.google.longrunning.Operation> promoteExperimentCallable()
Promotes the trial campaign thus applying changes in the trial campaign to the base campaign. This method returns a long running operation that tracks the promotion of the experiment campaign. If it fails, a list of errors can be retrieved using the ListExperimentAsyncErrors method. The operation's metadata will be a string containing the resource name of the created experiment.List of thrown errors: [AuthenticationError]() [AuthorizationError]() [ExperimentError]() [HeaderError]() [InternalError]() [QuotaError]() [RequestError]()
Sample code:
try (ExperimentServiceClient experimentServiceClient = ExperimentServiceClient.create()) { PromoteExperimentRequest request = PromoteExperimentRequest.newBuilder() .setResourceName(ExperimentName.of("[CUSTOMER_ID]", "[TRIAL_ID]").toString()) .setValidateOnly(true) .build(); ApiFuture<Operation> future = experimentServiceClient.promoteExperimentCallable().futureCall(request); // Do something. future.get(); }
-
close
public final void close()
- Specified by:
closein interfacejava.lang.AutoCloseable
-
shutdown
public void shutdown()
- Specified by:
shutdownin interfacecom.google.api.gax.core.BackgroundResource
-
isShutdown
public boolean isShutdown()
- Specified by:
isShutdownin interfacecom.google.api.gax.core.BackgroundResource
-
isTerminated
public boolean isTerminated()
- Specified by:
isTerminatedin interfacecom.google.api.gax.core.BackgroundResource
-
shutdownNow
public void shutdownNow()
- Specified by:
shutdownNowin interfacecom.google.api.gax.core.BackgroundResource
-
awaitTermination
public boolean awaitTermination(long duration, java.util.concurrent.TimeUnit unit) throws java.lang.InterruptedException- Specified by:
awaitTerminationin interfacecom.google.api.gax.core.BackgroundResource- Throws:
java.lang.InterruptedException
-
-