Class ExperimentServiceClient
- All Implemented Interfaces:
com.google.api.gax.core.BackgroundResource,AutoCloseable
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:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
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().
| Method | Description | Method Variants |
|---|---|---|
MutateExperiments |
Creates, updates, or removes experiments. Operation statuses are returned. List of thrown errors: [AuthenticationError]() [AuthorizationError]() [ExperimentError]() [HeaderError]() [InternalError]() [QuotaError]() [RequestError]() |
Request object method variants only take one parameter, a request object, which must be constructed before the call.
"Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method.
Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.
|
EndExperiment |
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]() |
Request object method variants only take one parameter, a request object, which must be constructed before the call.
"Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method.
Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.
|
ListExperimentAsyncErrors |
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]() |
Request object method variants only take one parameter, a request object, which must be constructed before the call.
Methods that return long-running operations have "Async" method variants that return `OperationFuture`, which is used to track polling of the service.
Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.
|
GraduateExperiment |
Graduates an experiment to a full campaign. List of thrown errors: [AuthenticationError]() [AuthorizationError]() [ExperimentError]() [HeaderError]() [InternalError]() [MutateError]() [QuotaError]() [RequestError]() |
Request object method variants only take one parameter, a request object, which must be constructed before the call.
"Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method.
Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.
|
ScheduleExperiment |
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]() |
Request object method variants only take one parameter, a request object, which must be constructed before the call.
Methods that return long-running operations have "Async" method variants that return `OperationFuture`, which is used to track polling of the service.
Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.
|
PromoteExperiment |
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]() |
Request object method variants only take one parameter, a request object, which must be constructed before the call.
Methods that return long-running operations have "Async" method variants that return `OperationFuture`, which is used to track polling of the service.
Callable method variants take no parameters and return 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:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
ExperimentServiceSettings experimentServiceSettings =
ExperimentServiceSettings.newBuilder()
.setCredentialsProvider(FixedCredentialsProvider.create(myCredentials))
.build();
ExperimentServiceClient experimentServiceClient =
ExperimentServiceClient.create(experimentServiceSettings);
To customize the endpoint:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
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 ClassesModifier and TypeClassDescriptionstatic classstatic classstatic class -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedConstructs an instance of ExperimentServiceClient, using the given settings.protected -
Method Summary
Modifier and TypeMethodDescriptionbooleanawaitTermination(long duration, TimeUnit unit) final voidclose()static final ExperimentServiceClientcreate()Constructs an instance of ExperimentServiceClient with default settings.static final ExperimentServiceClientcreate(ExperimentServiceSettings settings) Constructs an instance of ExperimentServiceClient, using the given settings.static final ExperimentServiceClientcreate(ExperimentServiceStub stub) Constructs an instance of ExperimentServiceClient, using the given stub for making calls.final voidendExperiment(ExperimentName experiment) Immediately ends an experiment, changing the experiment's scheduled end date and without waiting for end of day.final voidendExperiment(EndExperimentRequest request) Immediately ends an experiment, changing the experiment's scheduled end date and without waiting for end of day.final voidendExperiment(String experiment) Immediately ends an experiment, changing the experiment's scheduled end date and without waiting for end of day.final com.google.api.gax.rpc.UnaryCallable<EndExperimentRequest,com.google.protobuf.Empty> Immediately ends an experiment, changing the experiment's scheduled end date and without waiting for end of day.final com.google.longrunning.OperationsClientReturns the OperationsClient that can be used to query the status of a long-running operation returned by another API method call.getStub()final voidgraduateExperiment(ExperimentName experiment, List<CampaignBudgetMapping> campaignBudgetMappings) Graduates an experiment to a full campaign.final voidGraduates an experiment to a full campaign.final voidgraduateExperiment(String experiment, List<CampaignBudgetMapping> campaignBudgetMappings) Graduates an experiment to a full campaign.final com.google.api.gax.rpc.UnaryCallable<GraduateExperimentRequest,com.google.protobuf.Empty> Graduates an experiment to a full campaign.booleanbooleanlistExperimentAsyncErrors(ExperimentName resourceName) Returns all errors that occurred during the last Experiment update (either scheduling or promotion).Returns all errors that occurred during the last Experiment update (either scheduling or promotion).listExperimentAsyncErrors(String resourceName) Returns all errors that occurred during the last Experiment update (either scheduling or promotion).final com.google.api.gax.rpc.UnaryCallable<ListExperimentAsyncErrorsRequest,ListExperimentAsyncErrorsResponse> Returns all errors that occurred during the last Experiment update (either scheduling or promotion).final com.google.api.gax.rpc.UnaryCallable<ListExperimentAsyncErrorsRequest,ExperimentServiceClient.ListExperimentAsyncErrorsPagedResponse> Returns all errors that occurred during the last Experiment update (either scheduling or promotion).Creates, updates, or removes experiments.mutateExperiments(String customerId, List<ExperimentOperation> operations) Creates, updates, or removes experiments.final com.google.api.gax.rpc.UnaryCallable<MutateExperimentsRequest,MutateExperimentsResponse> Creates, updates, or removes experiments.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.final com.google.api.gax.longrunning.OperationFuture<com.google.protobuf.Empty,PromoteExperimentMetadata> Promotes the trial campaign thus applying changes in the trial campaign to the base campaign.final com.google.api.gax.longrunning.OperationFuture<com.google.protobuf.Empty,PromoteExperimentMetadata> promoteExperimentAsync(String resourceName) Promotes the trial campaign thus applying changes in the trial campaign to the base campaign.final com.google.api.gax.rpc.UnaryCallable<PromoteExperimentRequest,com.google.longrunning.Operation> Promotes the trial campaign thus applying changes in the trial campaign to the base campaign.final com.google.api.gax.rpc.OperationCallable<PromoteExperimentRequest,com.google.protobuf.Empty, PromoteExperimentMetadata> Promotes the trial campaign thus applying changes in the trial campaign to the base campaign.final com.google.api.gax.longrunning.OperationFuture<com.google.protobuf.Empty,ScheduleExperimentMetadata> scheduleExperimentAsync(ExperimentName resourceName) Schedule an experiment.final com.google.api.gax.longrunning.OperationFuture<com.google.protobuf.Empty,ScheduleExperimentMetadata> Schedule an experiment.final com.google.api.gax.longrunning.OperationFuture<com.google.protobuf.Empty,ScheduleExperimentMetadata> scheduleExperimentAsync(String resourceName) Schedule an experiment.final com.google.api.gax.rpc.UnaryCallable<ScheduleExperimentRequest,com.google.longrunning.Operation> Schedule an experiment.final com.google.api.gax.rpc.OperationCallable<ScheduleExperimentRequest,com.google.protobuf.Empty, ScheduleExperimentMetadata> Schedule an experiment.voidshutdown()void
-
Constructor Details
-
ExperimentServiceClient
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:
IOException
-
ExperimentServiceClient
-
-
Method Details
-
create
Constructs an instance of ExperimentServiceClient with default settings.- Throws:
IOException
-
create
public static final ExperimentServiceClient create(ExperimentServiceSettings settings) throws 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:
IOException
-
create
Constructs an instance of ExperimentServiceClient, using the given stub for making calls. This is for advanced usage - prefer using create(ExperimentServiceSettings). -
getSettings
-
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(String customerId, 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:
// This snippet has been automatically generated and should be regarded as a code template only. // It will require modifications to work: // - It may require correct/in-range values for request initialization. // - It may require specifying regional endpoints when creating the service client as shown in // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 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
Creates, updates, or removes experiments. Operation statuses are returned.List of thrown errors: [AuthenticationError]() [AuthorizationError]() [ExperimentError]() [HeaderError]() [InternalError]() [QuotaError]() [RequestError]()
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only. // It will require modifications to work: // - It may require correct/in-range values for request initialization. // - It may require specifying regional endpoints when creating the service client as shown in // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 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:
// This snippet has been automatically generated and should be regarded as a code template only. // It will require modifications to work: // - It may require correct/in-range values for request initialization. // - It may require specifying regional endpoints when creating the service client as shown in // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 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
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:
// This snippet has been automatically generated and should be regarded as a code template only. // It will require modifications to work: // - It may require correct/in-range values for request initialization. // - It may require specifying regional endpoints when creating the service client as shown in // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 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
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:
// This snippet has been automatically generated and should be regarded as a code template only. // It will require modifications to work: // - It may require correct/in-range values for request initialization. // - It may require specifying regional endpoints when creating the service client as shown in // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 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
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:
// This snippet has been automatically generated and should be regarded as a code template only. // It will require modifications to work: // - It may require correct/in-range values for request initialization. // - It may require specifying regional endpoints when creating the service client as shown in // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 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:
// This snippet has been automatically generated and should be regarded as a code template only. // It will require modifications to work: // - It may require correct/in-range values for request initialization. // - It may require specifying regional endpoints when creating the service client as shown in // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 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:
// This snippet has been automatically generated and should be regarded as a code template only. // It will require modifications to work: // - It may require correct/in-range values for request initialization. // - It may require specifying regional endpoints when creating the service client as shown in // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 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(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:
// This snippet has been automatically generated and should be regarded as a code template only. // It will require modifications to work: // - It may require correct/in-range values for request initialization. // - It may require specifying regional endpoints when creating the service client as shown in // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 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:
// This snippet has been automatically generated and should be regarded as a code template only. // It will require modifications to work: // - It may require correct/in-range values for request initialization. // - It may require specifying regional endpoints when creating the service client as shown in // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 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:
// This snippet has been automatically generated and should be regarded as a code template only. // It will require modifications to work: // - It may require correct/in-range values for request initialization. // - It may require specifying regional endpoints when creating the service client as shown in // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 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:
// This snippet has been automatically generated and should be regarded as a code template only. // It will require modifications to work: // - It may require correct/in-range values for request initialization. // - It may require specifying regional endpoints when creating the service client as shown in // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 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.getErrorsList()) { // 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, List<CampaignBudgetMapping> campaignBudgetMappings) Graduates an experiment to a full campaign.List of thrown errors: [AuthenticationError]() [AuthorizationError]() [ExperimentError]() [HeaderError]() [InternalError]() [MutateError]() [QuotaError]() [RequestError]()
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only. // It will require modifications to work: // - It may require correct/in-range values for request initialization. // - It may require specifying regional endpoints when creating the service client as shown in // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 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(String experiment, List<CampaignBudgetMapping> campaignBudgetMappings) Graduates an experiment to a full campaign.List of thrown errors: [AuthenticationError]() [AuthorizationError]() [ExperimentError]() [HeaderError]() [InternalError]() [MutateError]() [QuotaError]() [RequestError]()
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only. // It will require modifications to work: // - It may require correct/in-range values for request initialization. // - It may require specifying regional endpoints when creating the service client as shown in // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 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
Graduates an experiment to a full campaign.List of thrown errors: [AuthenticationError]() [AuthorizationError]() [ExperimentError]() [HeaderError]() [InternalError]() [MutateError]() [QuotaError]() [RequestError]()
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only. // It will require modifications to work: // - It may require correct/in-range values for request initialization. // - It may require specifying regional endpoints when creating the service client as shown in // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 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:
// This snippet has been automatically generated and should be regarded as a code template only. // It will require modifications to work: // - It may require correct/in-range values for request initialization. // - It may require specifying regional endpoints when creating the service client as shown in // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 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:
// This snippet has been automatically generated and should be regarded as a code template only. // It will require modifications to work: // - It may require correct/in-range values for request initialization. // - It may require specifying regional endpoints when creating the service client as shown in // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 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(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:
// This snippet has been automatically generated and should be regarded as a code template only. // It will require modifications to work: // - It may require correct/in-range values for request initialization. // - It may require specifying regional endpoints when creating the service client as shown in // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 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:
// This snippet has been automatically generated and should be regarded as a code template only. // It will require modifications to work: // - It may require correct/in-range values for request initialization. // - It may require specifying regional endpoints when creating the service client as shown in // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 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, scheduleExperimentOperationCallable()ScheduleExperimentMetadata> 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:
// This snippet has been automatically generated and should be regarded as a code template only. // It will require modifications to work: // - It may require correct/in-range values for request initialization. // - It may require specifying regional endpoints when creating the service client as shown in // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 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:
// This snippet has been automatically generated and should be regarded as a code template only. // It will require modifications to work: // - It may require correct/in-range values for request initialization. // - It may require specifying regional endpoints when creating the service client as shown in // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 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:
// This snippet has been automatically generated and should be regarded as a code template only. // It will require modifications to work: // - It may require correct/in-range values for request initialization. // - It may require specifying regional endpoints when creating the service client as shown in // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 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(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:
// This snippet has been automatically generated and should be regarded as a code template only. // It will require modifications to work: // - It may require correct/in-range values for request initialization. // - It may require specifying regional endpoints when creating the service client as shown in // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 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:
// This snippet has been automatically generated and should be regarded as a code template only. // It will require modifications to work: // - It may require correct/in-range values for request initialization. // - It may require specifying regional endpoints when creating the service client as shown in // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 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, promoteExperimentOperationCallable()PromoteExperimentMetadata> 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:
// This snippet has been automatically generated and should be regarded as a code template only. // It will require modifications to work: // - It may require correct/in-range values for request initialization. // - It may require specifying regional endpoints when creating the service client as shown in // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 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:
// This snippet has been automatically generated and should be regarded as a code template only. // It will require modifications to work: // - It may require correct/in-range values for request initialization. // - It may require specifying regional endpoints when creating the service client as shown in // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 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 interfaceAutoCloseable
-
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
- Specified by:
awaitTerminationin interfacecom.google.api.gax.core.BackgroundResource- Throws:
InterruptedException
-