@BetaApi @Generated(value="by gapic-generator-java") public class ExperimentsClient extends Object implements com.google.api.gax.core.BackgroundResource
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 (ExperimentsClient experimentsClient = ExperimentsClient.create()) {
ExperimentName name =
ExperimentName.of("[PROJECT]", "[LOCATION]", "[AGENT]", "[ENVIRONMENT]", "[EXPERIMENT]");
Experiment response = experimentsClient.getExperiment(name);
}
Note: close() needs to be called on the ExperimentsClient 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 |
|---|---|---|
ListExperiments |
Returns the list of all experiments in the specified [Environment][google.cloud.dialogflow.cx.v3beta1.Environment]. |
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.
|
GetExperiment |
Retrieves the specified [Experiment][google.cloud.dialogflow.cx.v3beta1.Experiment]. |
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.
|
CreateExperiment |
Creates an [Experiment][google.cloud.dialogflow.cx.v3beta1.Experiment] in the specified [Environment][google.cloud.dialogflow.cx.v3beta1.Environment]. |
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.
|
UpdateExperiment |
Updates the specified [Experiment][google.cloud.dialogflow.cx.v3beta1.Experiment]. |
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.
|
DeleteExperiment |
Deletes the specified [Experiment][google.cloud.dialogflow.cx.v3beta1.Experiment]. |
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.
|
StartExperiment |
Starts the specified [Experiment][google.cloud.dialogflow.cx.v3beta1.Experiment]. This rpc only changes the state of experiment from PENDING to RUNNING. |
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.
|
StopExperiment |
Stops the specified [Experiment][google.cloud.dialogflow.cx.v3beta1.Experiment]. This rpc only changes the state of experiment from RUNNING to DONE. |
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.
|
ListLocations |
Lists information about the supported locations for this service. |
Request object method variants only take one parameter, a request object, which must be constructed before the call.
Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.
|
GetLocation |
Gets information about a location. |
Request object method variants only take one parameter, a request object, which must be constructed before the call.
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 ExperimentsSettings 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
ExperimentsSettings experimentsSettings =
ExperimentsSettings.newBuilder()
.setCredentialsProvider(FixedCredentialsProvider.create(myCredentials))
.build();
ExperimentsClient experimentsClient = ExperimentsClient.create(experimentsSettings);
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
ExperimentsSettings experimentsSettings =
ExperimentsSettings.newBuilder().setEndpoint(myEndpoint).build();
ExperimentsClient experimentsClient = ExperimentsClient.create(experimentsSettings);
To use REST (HTTP1.1/JSON) transport (instead of gRPC) for sending and receiving requests over the wire:
// 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
ExperimentsSettings experimentsSettings = ExperimentsSettings.newHttpJsonBuilder().build();
ExperimentsClient experimentsClient = ExperimentsClient.create(experimentsSettings);
Please refer to the GitHub repository's samples for more quickstart code snippets.
| Modifier and Type | Class and Description |
|---|---|
static class |
ExperimentsClient.ListExperimentsFixedSizeCollection |
static class |
ExperimentsClient.ListExperimentsPage |
static class |
ExperimentsClient.ListExperimentsPagedResponse |
static class |
ExperimentsClient.ListLocationsFixedSizeCollection |
static class |
ExperimentsClient.ListLocationsPage |
static class |
ExperimentsClient.ListLocationsPagedResponse |
| Modifier | Constructor and Description |
|---|---|
protected |
ExperimentsClient(ExperimentsSettings settings)
Constructs an instance of ExperimentsClient, using the given settings.
|
protected |
ExperimentsClient(ExperimentsStub stub) |
| Modifier and Type | Method and Description |
|---|---|
boolean |
awaitTermination(long duration,
TimeUnit unit) |
void |
close() |
static ExperimentsClient |
create()
Constructs an instance of ExperimentsClient with default settings.
|
static ExperimentsClient |
create(ExperimentsSettings settings)
Constructs an instance of ExperimentsClient, using the given settings.
|
static ExperimentsClient |
create(ExperimentsStub stub)
Constructs an instance of ExperimentsClient, using the given stub for making calls.
|
Experiment |
createExperiment(CreateExperimentRequest request)
Creates an [Experiment][google.cloud.dialogflow.cx.v3beta1.Experiment] in the specified
[Environment][google.cloud.dialogflow.cx.v3beta1.Environment].
|
Experiment |
createExperiment(EnvironmentName parent,
Experiment experiment)
Creates an [Experiment][google.cloud.dialogflow.cx.v3beta1.Experiment] in the specified
[Environment][google.cloud.dialogflow.cx.v3beta1.Environment].
|
Experiment |
createExperiment(String parent,
Experiment experiment)
Creates an [Experiment][google.cloud.dialogflow.cx.v3beta1.Experiment] in the specified
[Environment][google.cloud.dialogflow.cx.v3beta1.Environment].
|
com.google.api.gax.rpc.UnaryCallable<CreateExperimentRequest,Experiment> |
createExperimentCallable()
Creates an [Experiment][google.cloud.dialogflow.cx.v3beta1.Experiment] in the specified
[Environment][google.cloud.dialogflow.cx.v3beta1.Environment].
|
void |
deleteExperiment(DeleteExperimentRequest request)
Deletes the specified [Experiment][google.cloud.dialogflow.cx.v3beta1.Experiment].
|
void |
deleteExperiment(ExperimentName name)
Deletes the specified [Experiment][google.cloud.dialogflow.cx.v3beta1.Experiment].
|
void |
deleteExperiment(String name)
Deletes the specified [Experiment][google.cloud.dialogflow.cx.v3beta1.Experiment].
|
com.google.api.gax.rpc.UnaryCallable<DeleteExperimentRequest,com.google.protobuf.Empty> |
deleteExperimentCallable()
Deletes the specified [Experiment][google.cloud.dialogflow.cx.v3beta1.Experiment].
|
Experiment |
getExperiment(ExperimentName name)
Retrieves the specified [Experiment][google.cloud.dialogflow.cx.v3beta1.Experiment].
|
Experiment |
getExperiment(GetExperimentRequest request)
Retrieves the specified [Experiment][google.cloud.dialogflow.cx.v3beta1.Experiment].
|
Experiment |
getExperiment(String name)
Retrieves the specified [Experiment][google.cloud.dialogflow.cx.v3beta1.Experiment].
|
com.google.api.gax.rpc.UnaryCallable<GetExperimentRequest,Experiment> |
getExperimentCallable()
Retrieves the specified [Experiment][google.cloud.dialogflow.cx.v3beta1.Experiment].
|
com.google.cloud.location.Location |
getLocation(com.google.cloud.location.GetLocationRequest request)
Gets information about a location.
|
com.google.api.gax.rpc.UnaryCallable<com.google.cloud.location.GetLocationRequest,com.google.cloud.location.Location> |
getLocationCallable()
Gets information about a location.
|
ExperimentsSettings |
getSettings() |
ExperimentsStub |
getStub() |
boolean |
isShutdown() |
boolean |
isTerminated() |
ExperimentsClient.ListExperimentsPagedResponse |
listExperiments(EnvironmentName parent)
Returns the list of all experiments in the specified
[Environment][google.cloud.dialogflow.cx.v3beta1.Environment].
|
ExperimentsClient.ListExperimentsPagedResponse |
listExperiments(ListExperimentsRequest request)
Returns the list of all experiments in the specified
[Environment][google.cloud.dialogflow.cx.v3beta1.Environment].
|
ExperimentsClient.ListExperimentsPagedResponse |
listExperiments(String parent)
Returns the list of all experiments in the specified
[Environment][google.cloud.dialogflow.cx.v3beta1.Environment].
|
com.google.api.gax.rpc.UnaryCallable<ListExperimentsRequest,ListExperimentsResponse> |
listExperimentsCallable()
Returns the list of all experiments in the specified
[Environment][google.cloud.dialogflow.cx.v3beta1.Environment].
|
com.google.api.gax.rpc.UnaryCallable<ListExperimentsRequest,ExperimentsClient.ListExperimentsPagedResponse> |
listExperimentsPagedCallable()
Returns the list of all experiments in the specified
[Environment][google.cloud.dialogflow.cx.v3beta1.Environment].
|
ExperimentsClient.ListLocationsPagedResponse |
listLocations(com.google.cloud.location.ListLocationsRequest request)
Lists information about the supported locations for this service.
|
com.google.api.gax.rpc.UnaryCallable<com.google.cloud.location.ListLocationsRequest,com.google.cloud.location.ListLocationsResponse> |
listLocationsCallable()
Lists information about the supported locations for this service.
|
com.google.api.gax.rpc.UnaryCallable<com.google.cloud.location.ListLocationsRequest,ExperimentsClient.ListLocationsPagedResponse> |
listLocationsPagedCallable()
Lists information about the supported locations for this service.
|
void |
shutdown() |
void |
shutdownNow() |
Experiment |
startExperiment(ExperimentName name)
Starts the specified [Experiment][google.cloud.dialogflow.cx.v3beta1.Experiment].
|
Experiment |
startExperiment(StartExperimentRequest request)
Starts the specified [Experiment][google.cloud.dialogflow.cx.v3beta1.Experiment].
|
Experiment |
startExperiment(String name)
Starts the specified [Experiment][google.cloud.dialogflow.cx.v3beta1.Experiment].
|
com.google.api.gax.rpc.UnaryCallable<StartExperimentRequest,Experiment> |
startExperimentCallable()
Starts the specified [Experiment][google.cloud.dialogflow.cx.v3beta1.Experiment].
|
Experiment |
stopExperiment(ExperimentName name)
Stops the specified [Experiment][google.cloud.dialogflow.cx.v3beta1.Experiment].
|
Experiment |
stopExperiment(StopExperimentRequest request)
Stops the specified [Experiment][google.cloud.dialogflow.cx.v3beta1.Experiment].
|
Experiment |
stopExperiment(String name)
Stops the specified [Experiment][google.cloud.dialogflow.cx.v3beta1.Experiment].
|
com.google.api.gax.rpc.UnaryCallable<StopExperimentRequest,Experiment> |
stopExperimentCallable()
Stops the specified [Experiment][google.cloud.dialogflow.cx.v3beta1.Experiment].
|
Experiment |
updateExperiment(Experiment experiment,
com.google.protobuf.FieldMask updateMask)
Updates the specified [Experiment][google.cloud.dialogflow.cx.v3beta1.Experiment].
|
Experiment |
updateExperiment(UpdateExperimentRequest request)
Updates the specified [Experiment][google.cloud.dialogflow.cx.v3beta1.Experiment].
|
com.google.api.gax.rpc.UnaryCallable<UpdateExperimentRequest,Experiment> |
updateExperimentCallable()
Updates the specified [Experiment][google.cloud.dialogflow.cx.v3beta1.Experiment].
|
protected ExperimentsClient(ExperimentsSettings settings) throws IOException
IOExceptionprotected ExperimentsClient(ExperimentsStub stub)
public static final ExperimentsClient create() throws IOException
IOExceptionpublic static final ExperimentsClient create(ExperimentsSettings settings) throws IOException
IOExceptionpublic static final ExperimentsClient create(ExperimentsStub stub)
public final ExperimentsSettings getSettings()
public ExperimentsStub getStub()
public final ExperimentsClient.ListExperimentsPagedResponse listExperiments(EnvironmentName parent)
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 (ExperimentsClient experimentsClient = ExperimentsClient.create()) {
EnvironmentName parent =
EnvironmentName.of("[PROJECT]", "[LOCATION]", "[AGENT]", "[ENVIRONMENT]");
for (Experiment element : experimentsClient.listExperiments(parent).iterateAll()) {
// doThingsWith(element);
}
}
parent - Required. The [Environment][google.cloud.dialogflow.cx.v3beta1.Environment] to
list all environments for. Format:
`projects/<ProjectID>/locations/<LocationID>/agents/<AgentID>/environments/<EnvironmentID>`.com.google.api.gax.rpc.ApiException - if the remote call failspublic final ExperimentsClient.ListExperimentsPagedResponse listExperiments(String parent)
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 (ExperimentsClient experimentsClient = ExperimentsClient.create()) {
String parent =
EnvironmentName.of("[PROJECT]", "[LOCATION]", "[AGENT]", "[ENVIRONMENT]").toString();
for (Experiment element : experimentsClient.listExperiments(parent).iterateAll()) {
// doThingsWith(element);
}
}
parent - Required. The [Environment][google.cloud.dialogflow.cx.v3beta1.Environment] to
list all environments for. Format:
`projects/<ProjectID>/locations/<LocationID>/agents/<AgentID>/environments/<EnvironmentID>`.com.google.api.gax.rpc.ApiException - if the remote call failspublic final ExperimentsClient.ListExperimentsPagedResponse listExperiments(ListExperimentsRequest request)
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 (ExperimentsClient experimentsClient = ExperimentsClient.create()) {
ListExperimentsRequest request =
ListExperimentsRequest.newBuilder()
.setParent(
EnvironmentName.of("[PROJECT]", "[LOCATION]", "[AGENT]", "[ENVIRONMENT]")
.toString())
.setPageSize(883849137)
.setPageToken("pageToken873572522")
.build();
for (Experiment element : experimentsClient.listExperiments(request).iterateAll()) {
// doThingsWith(element);
}
}
request - The request object containing all of the parameters for the API call.com.google.api.gax.rpc.ApiException - if the remote call failspublic final com.google.api.gax.rpc.UnaryCallable<ListExperimentsRequest,ExperimentsClient.ListExperimentsPagedResponse> listExperimentsPagedCallable()
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 (ExperimentsClient experimentsClient = ExperimentsClient.create()) {
ListExperimentsRequest request =
ListExperimentsRequest.newBuilder()
.setParent(
EnvironmentName.of("[PROJECT]", "[LOCATION]", "[AGENT]", "[ENVIRONMENT]")
.toString())
.setPageSize(883849137)
.setPageToken("pageToken873572522")
.build();
ApiFuture<Experiment> future =
experimentsClient.listExperimentsPagedCallable().futureCall(request);
// Do something.
for (Experiment element : future.get().iterateAll()) {
// doThingsWith(element);
}
}
public final com.google.api.gax.rpc.UnaryCallable<ListExperimentsRequest,ListExperimentsResponse> listExperimentsCallable()
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 (ExperimentsClient experimentsClient = ExperimentsClient.create()) {
ListExperimentsRequest request =
ListExperimentsRequest.newBuilder()
.setParent(
EnvironmentName.of("[PROJECT]", "[LOCATION]", "[AGENT]", "[ENVIRONMENT]")
.toString())
.setPageSize(883849137)
.setPageToken("pageToken873572522")
.build();
while (true) {
ListExperimentsResponse response =
experimentsClient.listExperimentsCallable().call(request);
for (Experiment element : response.getExperimentsList()) {
// doThingsWith(element);
}
String nextPageToken = response.getNextPageToken();
if (!Strings.isNullOrEmpty(nextPageToken)) {
request = request.toBuilder().setPageToken(nextPageToken).build();
} else {
break;
}
}
}
public final Experiment getExperiment(ExperimentName name)
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 (ExperimentsClient experimentsClient = ExperimentsClient.create()) {
ExperimentName name =
ExperimentName.of("[PROJECT]", "[LOCATION]", "[AGENT]", "[ENVIRONMENT]", "[EXPERIMENT]");
Experiment response = experimentsClient.getExperiment(name);
}
name - Required. The name of the
[Environment][google.cloud.dialogflow.cx.v3beta1.Environment]. Format:
`projects/<ProjectID>/locations/<LocationID>/agents/<AgentID>/environments/<EnvironmentID>/experiments/<ExperimentID>`.com.google.api.gax.rpc.ApiException - if the remote call failspublic final Experiment getExperiment(String name)
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 (ExperimentsClient experimentsClient = ExperimentsClient.create()) {
String name =
ExperimentName.of("[PROJECT]", "[LOCATION]", "[AGENT]", "[ENVIRONMENT]", "[EXPERIMENT]")
.toString();
Experiment response = experimentsClient.getExperiment(name);
}
name - Required. The name of the
[Environment][google.cloud.dialogflow.cx.v3beta1.Environment]. Format:
`projects/<ProjectID>/locations/<LocationID>/agents/<AgentID>/environments/<EnvironmentID>/experiments/<ExperimentID>`.com.google.api.gax.rpc.ApiException - if the remote call failspublic final Experiment getExperiment(GetExperimentRequest request)
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 (ExperimentsClient experimentsClient = ExperimentsClient.create()) {
GetExperimentRequest request =
GetExperimentRequest.newBuilder()
.setName(
ExperimentName.of(
"[PROJECT]", "[LOCATION]", "[AGENT]", "[ENVIRONMENT]", "[EXPERIMENT]")
.toString())
.build();
Experiment response = experimentsClient.getExperiment(request);
}
request - The request object containing all of the parameters for the API call.com.google.api.gax.rpc.ApiException - if the remote call failspublic final com.google.api.gax.rpc.UnaryCallable<GetExperimentRequest,Experiment> getExperimentCallable()
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 (ExperimentsClient experimentsClient = ExperimentsClient.create()) {
GetExperimentRequest request =
GetExperimentRequest.newBuilder()
.setName(
ExperimentName.of(
"[PROJECT]", "[LOCATION]", "[AGENT]", "[ENVIRONMENT]", "[EXPERIMENT]")
.toString())
.build();
ApiFuture<Experiment> future = experimentsClient.getExperimentCallable().futureCall(request);
// Do something.
Experiment response = future.get();
}
public final Experiment createExperiment(EnvironmentName parent, Experiment experiment)
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 (ExperimentsClient experimentsClient = ExperimentsClient.create()) {
EnvironmentName parent =
EnvironmentName.of("[PROJECT]", "[LOCATION]", "[AGENT]", "[ENVIRONMENT]");
Experiment experiment = Experiment.newBuilder().build();
Experiment response = experimentsClient.createExperiment(parent, experiment);
}
parent - Required. The [Agent][google.cloud.dialogflow.cx.v3beta1.Agent] to create an
[Environment][google.cloud.dialogflow.cx.v3beta1.Environment] for. Format:
`projects/<ProjectID>/locations/<LocationID>/agents/<AgentID>/environments/<EnvironmentID>`.experiment - Required. The experiment to create.com.google.api.gax.rpc.ApiException - if the remote call failspublic final Experiment createExperiment(String parent, Experiment experiment)
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 (ExperimentsClient experimentsClient = ExperimentsClient.create()) {
String parent =
EnvironmentName.of("[PROJECT]", "[LOCATION]", "[AGENT]", "[ENVIRONMENT]").toString();
Experiment experiment = Experiment.newBuilder().build();
Experiment response = experimentsClient.createExperiment(parent, experiment);
}
parent - Required. The [Agent][google.cloud.dialogflow.cx.v3beta1.Agent] to create an
[Environment][google.cloud.dialogflow.cx.v3beta1.Environment] for. Format:
`projects/<ProjectID>/locations/<LocationID>/agents/<AgentID>/environments/<EnvironmentID>`.experiment - Required. The experiment to create.com.google.api.gax.rpc.ApiException - if the remote call failspublic final Experiment createExperiment(CreateExperimentRequest request)
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 (ExperimentsClient experimentsClient = ExperimentsClient.create()) {
CreateExperimentRequest request =
CreateExperimentRequest.newBuilder()
.setParent(
EnvironmentName.of("[PROJECT]", "[LOCATION]", "[AGENT]", "[ENVIRONMENT]")
.toString())
.setExperiment(Experiment.newBuilder().build())
.build();
Experiment response = experimentsClient.createExperiment(request);
}
request - The request object containing all of the parameters for the API call.com.google.api.gax.rpc.ApiException - if the remote call failspublic final com.google.api.gax.rpc.UnaryCallable<CreateExperimentRequest,Experiment> createExperimentCallable()
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 (ExperimentsClient experimentsClient = ExperimentsClient.create()) {
CreateExperimentRequest request =
CreateExperimentRequest.newBuilder()
.setParent(
EnvironmentName.of("[PROJECT]", "[LOCATION]", "[AGENT]", "[ENVIRONMENT]")
.toString())
.setExperiment(Experiment.newBuilder().build())
.build();
ApiFuture<Experiment> future =
experimentsClient.createExperimentCallable().futureCall(request);
// Do something.
Experiment response = future.get();
}
public final Experiment updateExperiment(Experiment experiment, com.google.protobuf.FieldMask updateMask)
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 (ExperimentsClient experimentsClient = ExperimentsClient.create()) {
Experiment experiment = Experiment.newBuilder().build();
FieldMask updateMask = FieldMask.newBuilder().build();
Experiment response = experimentsClient.updateExperiment(experiment, updateMask);
}
experiment - Required. The experiment to update.updateMask - Required. The mask to control which fields get updated.com.google.api.gax.rpc.ApiException - if the remote call failspublic final Experiment updateExperiment(UpdateExperimentRequest request)
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 (ExperimentsClient experimentsClient = ExperimentsClient.create()) {
UpdateExperimentRequest request =
UpdateExperimentRequest.newBuilder()
.setExperiment(Experiment.newBuilder().build())
.setUpdateMask(FieldMask.newBuilder().build())
.build();
Experiment response = experimentsClient.updateExperiment(request);
}
request - The request object containing all of the parameters for the API call.com.google.api.gax.rpc.ApiException - if the remote call failspublic final com.google.api.gax.rpc.UnaryCallable<UpdateExperimentRequest,Experiment> updateExperimentCallable()
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 (ExperimentsClient experimentsClient = ExperimentsClient.create()) {
UpdateExperimentRequest request =
UpdateExperimentRequest.newBuilder()
.setExperiment(Experiment.newBuilder().build())
.setUpdateMask(FieldMask.newBuilder().build())
.build();
ApiFuture<Experiment> future =
experimentsClient.updateExperimentCallable().futureCall(request);
// Do something.
Experiment response = future.get();
}
public final void deleteExperiment(ExperimentName name)
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 (ExperimentsClient experimentsClient = ExperimentsClient.create()) {
ExperimentName name =
ExperimentName.of("[PROJECT]", "[LOCATION]", "[AGENT]", "[ENVIRONMENT]", "[EXPERIMENT]");
experimentsClient.deleteExperiment(name);
}
name - Required. The name of the
[Environment][google.cloud.dialogflow.cx.v3beta1.Environment] to delete. Format:
`projects/<ProjectID>/locations/<LocationID>/agents/<AgentID>/environments/<EnvironmentID>/experiments/<ExperimentID>`.com.google.api.gax.rpc.ApiException - if the remote call failspublic final void deleteExperiment(String name)
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 (ExperimentsClient experimentsClient = ExperimentsClient.create()) {
String name =
ExperimentName.of("[PROJECT]", "[LOCATION]", "[AGENT]", "[ENVIRONMENT]", "[EXPERIMENT]")
.toString();
experimentsClient.deleteExperiment(name);
}
name - Required. The name of the
[Environment][google.cloud.dialogflow.cx.v3beta1.Environment] to delete. Format:
`projects/<ProjectID>/locations/<LocationID>/agents/<AgentID>/environments/<EnvironmentID>/experiments/<ExperimentID>`.com.google.api.gax.rpc.ApiException - if the remote call failspublic final void deleteExperiment(DeleteExperimentRequest request)
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 (ExperimentsClient experimentsClient = ExperimentsClient.create()) {
DeleteExperimentRequest request =
DeleteExperimentRequest.newBuilder()
.setName(
ExperimentName.of(
"[PROJECT]", "[LOCATION]", "[AGENT]", "[ENVIRONMENT]", "[EXPERIMENT]")
.toString())
.build();
experimentsClient.deleteExperiment(request);
}
request - The request object containing all of the parameters for the API call.com.google.api.gax.rpc.ApiException - if the remote call failspublic final com.google.api.gax.rpc.UnaryCallable<DeleteExperimentRequest,com.google.protobuf.Empty> deleteExperimentCallable()
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 (ExperimentsClient experimentsClient = ExperimentsClient.create()) {
DeleteExperimentRequest request =
DeleteExperimentRequest.newBuilder()
.setName(
ExperimentName.of(
"[PROJECT]", "[LOCATION]", "[AGENT]", "[ENVIRONMENT]", "[EXPERIMENT]")
.toString())
.build();
ApiFuture<Empty> future = experimentsClient.deleteExperimentCallable().futureCall(request);
// Do something.
future.get();
}
public final Experiment startExperiment(ExperimentName name)
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 (ExperimentsClient experimentsClient = ExperimentsClient.create()) {
ExperimentName name =
ExperimentName.of("[PROJECT]", "[LOCATION]", "[AGENT]", "[ENVIRONMENT]", "[EXPERIMENT]");
Experiment response = experimentsClient.startExperiment(name);
}
name - Required. Resource name of the experiment to start. Format:
`projects/<ProjectID>/locations/<LocationID>/agents/<AgentID>/environments/<EnvironmentID>/experiments/<ExperimentID>`.com.google.api.gax.rpc.ApiException - if the remote call failspublic final Experiment startExperiment(String name)
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 (ExperimentsClient experimentsClient = ExperimentsClient.create()) {
String name =
ExperimentName.of("[PROJECT]", "[LOCATION]", "[AGENT]", "[ENVIRONMENT]", "[EXPERIMENT]")
.toString();
Experiment response = experimentsClient.startExperiment(name);
}
name - Required. Resource name of the experiment to start. Format:
`projects/<ProjectID>/locations/<LocationID>/agents/<AgentID>/environments/<EnvironmentID>/experiments/<ExperimentID>`.com.google.api.gax.rpc.ApiException - if the remote call failspublic final Experiment startExperiment(StartExperimentRequest request)
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 (ExperimentsClient experimentsClient = ExperimentsClient.create()) {
StartExperimentRequest request =
StartExperimentRequest.newBuilder()
.setName(
ExperimentName.of(
"[PROJECT]", "[LOCATION]", "[AGENT]", "[ENVIRONMENT]", "[EXPERIMENT]")
.toString())
.build();
Experiment response = experimentsClient.startExperiment(request);
}
request - The request object containing all of the parameters for the API call.com.google.api.gax.rpc.ApiException - if the remote call failspublic final com.google.api.gax.rpc.UnaryCallable<StartExperimentRequest,Experiment> startExperimentCallable()
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 (ExperimentsClient experimentsClient = ExperimentsClient.create()) {
StartExperimentRequest request =
StartExperimentRequest.newBuilder()
.setName(
ExperimentName.of(
"[PROJECT]", "[LOCATION]", "[AGENT]", "[ENVIRONMENT]", "[EXPERIMENT]")
.toString())
.build();
ApiFuture<Experiment> future =
experimentsClient.startExperimentCallable().futureCall(request);
// Do something.
Experiment response = future.get();
}
public final Experiment stopExperiment(ExperimentName name)
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 (ExperimentsClient experimentsClient = ExperimentsClient.create()) {
ExperimentName name =
ExperimentName.of("[PROJECT]", "[LOCATION]", "[AGENT]", "[ENVIRONMENT]", "[EXPERIMENT]");
Experiment response = experimentsClient.stopExperiment(name);
}
name - Required. Resource name of the experiment to stop. Format:
`projects/<ProjectID>/locations/<LocationID>/agents/<AgentID>/environments/<EnvironmentID>/experiments/<ExperimentID>`.com.google.api.gax.rpc.ApiException - if the remote call failspublic final Experiment stopExperiment(String name)
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 (ExperimentsClient experimentsClient = ExperimentsClient.create()) {
String name =
ExperimentName.of("[PROJECT]", "[LOCATION]", "[AGENT]", "[ENVIRONMENT]", "[EXPERIMENT]")
.toString();
Experiment response = experimentsClient.stopExperiment(name);
}
name - Required. Resource name of the experiment to stop. Format:
`projects/<ProjectID>/locations/<LocationID>/agents/<AgentID>/environments/<EnvironmentID>/experiments/<ExperimentID>`.com.google.api.gax.rpc.ApiException - if the remote call failspublic final Experiment stopExperiment(StopExperimentRequest request)
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 (ExperimentsClient experimentsClient = ExperimentsClient.create()) {
StopExperimentRequest request =
StopExperimentRequest.newBuilder()
.setName(
ExperimentName.of(
"[PROJECT]", "[LOCATION]", "[AGENT]", "[ENVIRONMENT]", "[EXPERIMENT]")
.toString())
.build();
Experiment response = experimentsClient.stopExperiment(request);
}
request - The request object containing all of the parameters for the API call.com.google.api.gax.rpc.ApiException - if the remote call failspublic final com.google.api.gax.rpc.UnaryCallable<StopExperimentRequest,Experiment> stopExperimentCallable()
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 (ExperimentsClient experimentsClient = ExperimentsClient.create()) {
StopExperimentRequest request =
StopExperimentRequest.newBuilder()
.setName(
ExperimentName.of(
"[PROJECT]", "[LOCATION]", "[AGENT]", "[ENVIRONMENT]", "[EXPERIMENT]")
.toString())
.build();
ApiFuture<Experiment> future = experimentsClient.stopExperimentCallable().futureCall(request);
// Do something.
Experiment response = future.get();
}
public final ExperimentsClient.ListLocationsPagedResponse listLocations(com.google.cloud.location.ListLocationsRequest request)
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 (ExperimentsClient experimentsClient = ExperimentsClient.create()) {
ListLocationsRequest request =
ListLocationsRequest.newBuilder()
.setName("name3373707")
.setFilter("filter-1274492040")
.setPageSize(883849137)
.setPageToken("pageToken873572522")
.build();
for (Location element : experimentsClient.listLocations(request).iterateAll()) {
// doThingsWith(element);
}
}
request - The request object containing all of the parameters for the API call.com.google.api.gax.rpc.ApiException - if the remote call failspublic final com.google.api.gax.rpc.UnaryCallable<com.google.cloud.location.ListLocationsRequest,ExperimentsClient.ListLocationsPagedResponse> listLocationsPagedCallable()
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 (ExperimentsClient experimentsClient = ExperimentsClient.create()) {
ListLocationsRequest request =
ListLocationsRequest.newBuilder()
.setName("name3373707")
.setFilter("filter-1274492040")
.setPageSize(883849137)
.setPageToken("pageToken873572522")
.build();
ApiFuture<Location> future =
experimentsClient.listLocationsPagedCallable().futureCall(request);
// Do something.
for (Location element : future.get().iterateAll()) {
// doThingsWith(element);
}
}
public final com.google.api.gax.rpc.UnaryCallable<com.google.cloud.location.ListLocationsRequest,com.google.cloud.location.ListLocationsResponse> listLocationsCallable()
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 (ExperimentsClient experimentsClient = ExperimentsClient.create()) {
ListLocationsRequest request =
ListLocationsRequest.newBuilder()
.setName("name3373707")
.setFilter("filter-1274492040")
.setPageSize(883849137)
.setPageToken("pageToken873572522")
.build();
while (true) {
ListLocationsResponse response = experimentsClient.listLocationsCallable().call(request);
for (Location element : response.getLocationsList()) {
// doThingsWith(element);
}
String nextPageToken = response.getNextPageToken();
if (!Strings.isNullOrEmpty(nextPageToken)) {
request = request.toBuilder().setPageToken(nextPageToken).build();
} else {
break;
}
}
}
public final com.google.cloud.location.Location getLocation(com.google.cloud.location.GetLocationRequest request)
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 (ExperimentsClient experimentsClient = ExperimentsClient.create()) {
GetLocationRequest request = GetLocationRequest.newBuilder().setName("name3373707").build();
Location response = experimentsClient.getLocation(request);
}
request - The request object containing all of the parameters for the API call.com.google.api.gax.rpc.ApiException - if the remote call failspublic final com.google.api.gax.rpc.UnaryCallable<com.google.cloud.location.GetLocationRequest,com.google.cloud.location.Location> getLocationCallable()
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 (ExperimentsClient experimentsClient = ExperimentsClient.create()) {
GetLocationRequest request = GetLocationRequest.newBuilder().setName("name3373707").build();
ApiFuture<Location> future = experimentsClient.getLocationCallable().futureCall(request);
// Do something.
Location response = future.get();
}
public final void close()
close in interface AutoCloseablepublic void shutdown()
shutdown in interface com.google.api.gax.core.BackgroundResourcepublic boolean isShutdown()
isShutdown in interface com.google.api.gax.core.BackgroundResourcepublic boolean isTerminated()
isTerminated in interface com.google.api.gax.core.BackgroundResourcepublic void shutdownNow()
shutdownNow in interface com.google.api.gax.core.BackgroundResourcepublic boolean awaitTermination(long duration,
TimeUnit unit)
throws InterruptedException
awaitTermination in interface com.google.api.gax.core.BackgroundResourceInterruptedExceptionCopyright © 2025 Google LLC. All rights reserved.