Class ExperimentsClient
- java.lang.Object
-
- com.google.cloud.dialogflow.cx.v3.ExperimentsClient
-
- All Implemented Interfaces:
com.google.api.gax.core.BackgroundResource
,AutoCloseable
@Generated("by gapic-generator-java") public class ExperimentsClient extends Object implements com.google.api.gax.core.BackgroundResource
Service Description: Service for managing [Experiments][google.cloud.dialogflow.cx.v3.Experiment].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().
The surface of this class includes several types of Java methods for each of the API's methods:
- A "flattened" method. With this type of method, the fields of the request type have been converted into function parameters. It may be the case that not all fields are available as parameters, and not every API method will have a flattened method entry point.
- A "request object" method. This type of method only takes one parameter, a request object, which must be constructed before the call. Not every API method will have a request object method.
- A "callable" method. This type of method takes no parameters and returns an immutable API callable object, which can be used to initiate calls to the service.
See the individual methods for example code.
Many parameters require resource names to be formatted in a particular way. To assist with these names, this class includes a format method for each type of name, and additionally a parse method to extract the individual identifiers contained within names that are returned.
This class can be customized by passing in a custom instance of 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.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class 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
-
Constructor Summary
Constructors Modifier Constructor Description protected
ExperimentsClient(ExperimentsSettings settings)
Constructs an instance of ExperimentsClient, using the given settings.protected
ExperimentsClient(ExperimentsStub stub)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method 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.v3.Experiment] in the specified [Environment][google.cloud.dialogflow.cx.v3.Environment].Experiment
createExperiment(EnvironmentName parent, Experiment experiment)
Creates an [Experiment][google.cloud.dialogflow.cx.v3.Experiment] in the specified [Environment][google.cloud.dialogflow.cx.v3.Environment].Experiment
createExperiment(String parent, Experiment experiment)
Creates an [Experiment][google.cloud.dialogflow.cx.v3.Experiment] in the specified [Environment][google.cloud.dialogflow.cx.v3.Environment].com.google.api.gax.rpc.UnaryCallable<CreateExperimentRequest,Experiment>
createExperimentCallable()
Creates an [Experiment][google.cloud.dialogflow.cx.v3.Experiment] in the specified [Environment][google.cloud.dialogflow.cx.v3.Environment].void
deleteExperiment(DeleteExperimentRequest request)
Deletes the specified [Experiment][google.cloud.dialogflow.cx.v3.Experiment].void
deleteExperiment(ExperimentName name)
Deletes the specified [Experiment][google.cloud.dialogflow.cx.v3.Experiment].void
deleteExperiment(String name)
Deletes the specified [Experiment][google.cloud.dialogflow.cx.v3.Experiment].com.google.api.gax.rpc.UnaryCallable<DeleteExperimentRequest,com.google.protobuf.Empty>
deleteExperimentCallable()
Deletes the specified [Experiment][google.cloud.dialogflow.cx.v3.Experiment].Experiment
getExperiment(ExperimentName name)
Retrieves the specified [Experiment][google.cloud.dialogflow.cx.v3.Experiment].Experiment
getExperiment(GetExperimentRequest request)
Retrieves the specified [Experiment][google.cloud.dialogflow.cx.v3.Experiment].Experiment
getExperiment(String name)
Retrieves the specified [Experiment][google.cloud.dialogflow.cx.v3.Experiment].com.google.api.gax.rpc.UnaryCallable<GetExperimentRequest,Experiment>
getExperimentCallable()
Retrieves the specified [Experiment][google.cloud.dialogflow.cx.v3.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.v3.Environment].ExperimentsClient.ListExperimentsPagedResponse
listExperiments(ListExperimentsRequest request)
Returns the list of all experiments in the specified [Environment][google.cloud.dialogflow.cx.v3.Environment].ExperimentsClient.ListExperimentsPagedResponse
listExperiments(String parent)
Returns the list of all experiments in the specified [Environment][google.cloud.dialogflow.cx.v3.Environment].com.google.api.gax.rpc.UnaryCallable<ListExperimentsRequest,ListExperimentsResponse>
listExperimentsCallable()
Returns the list of all experiments in the specified [Environment][google.cloud.dialogflow.cx.v3.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.v3.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.v3.Experiment].Experiment
startExperiment(StartExperimentRequest request)
Starts the specified [Experiment][google.cloud.dialogflow.cx.v3.Experiment].Experiment
startExperiment(String name)
Starts the specified [Experiment][google.cloud.dialogflow.cx.v3.Experiment].com.google.api.gax.rpc.UnaryCallable<StartExperimentRequest,Experiment>
startExperimentCallable()
Starts the specified [Experiment][google.cloud.dialogflow.cx.v3.Experiment].Experiment
stopExperiment(ExperimentName name)
Stops the specified [Experiment][google.cloud.dialogflow.cx.v3.Experiment].Experiment
stopExperiment(StopExperimentRequest request)
Stops the specified [Experiment][google.cloud.dialogflow.cx.v3.Experiment].Experiment
stopExperiment(String name)
Stops the specified [Experiment][google.cloud.dialogflow.cx.v3.Experiment].com.google.api.gax.rpc.UnaryCallable<StopExperimentRequest,Experiment>
stopExperimentCallable()
Stops the specified [Experiment][google.cloud.dialogflow.cx.v3.Experiment].Experiment
updateExperiment(Experiment experiment, com.google.protobuf.FieldMask updateMask)
Updates the specified [Experiment][google.cloud.dialogflow.cx.v3.Experiment].Experiment
updateExperiment(UpdateExperimentRequest request)
Updates the specified [Experiment][google.cloud.dialogflow.cx.v3.Experiment].com.google.api.gax.rpc.UnaryCallable<UpdateExperimentRequest,Experiment>
updateExperimentCallable()
Updates the specified [Experiment][google.cloud.dialogflow.cx.v3.Experiment].
-
-
-
Constructor Detail
-
ExperimentsClient
protected ExperimentsClient(ExperimentsSettings settings) throws IOException
Constructs an instance of ExperimentsClient, 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
-
ExperimentsClient
protected ExperimentsClient(ExperimentsStub stub)
-
-
Method Detail
-
create
public static final ExperimentsClient create() throws IOException
Constructs an instance of ExperimentsClient with default settings.- Throws:
IOException
-
create
public static final ExperimentsClient create(ExperimentsSettings settings) throws IOException
Constructs an instance of ExperimentsClient, 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
public static final ExperimentsClient create(ExperimentsStub stub)
Constructs an instance of ExperimentsClient, using the given stub for making calls. This is for advanced usage - prefer using create(ExperimentsSettings).
-
getSettings
public final ExperimentsSettings getSettings()
-
getStub
public ExperimentsStub getStub()
-
listExperiments
public final ExperimentsClient.ListExperimentsPagedResponse listExperiments(EnvironmentName parent)
Returns the list of all experiments in the specified [Environment][google.cloud.dialogflow.cx.v3.Environment].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); } }
- Parameters:
parent
- Required. The [Environment][google.cloud.dialogflow.cx.v3.Environment] to list all environments for. Format: `projects/<Project ID>/locations/<Location ID>/agents/<Agent ID>/environments/<Environment ID>`.- Throws:
com.google.api.gax.rpc.ApiException
- if the remote call fails
-
listExperiments
public final ExperimentsClient.ListExperimentsPagedResponse listExperiments(String parent)
Returns the list of all experiments in the specified [Environment][google.cloud.dialogflow.cx.v3.Environment].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); } }
- Parameters:
parent
- Required. The [Environment][google.cloud.dialogflow.cx.v3.Environment] to list all environments for. Format: `projects/<Project ID>/locations/<Location ID>/agents/<Agent ID>/environments/<Environment ID>`.- Throws:
com.google.api.gax.rpc.ApiException
- if the remote call fails
-
listExperiments
public final ExperimentsClient.ListExperimentsPagedResponse listExperiments(ListExperimentsRequest request)
Returns the list of all experiments in the specified [Environment][google.cloud.dialogflow.cx.v3.Environment].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); } }
- 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
-
listExperimentsPagedCallable
public final com.google.api.gax.rpc.UnaryCallable<ListExperimentsRequest,ExperimentsClient.ListExperimentsPagedResponse> listExperimentsPagedCallable()
Returns the list of all experiments in the specified [Environment][google.cloud.dialogflow.cx.v3.Environment].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); } }
-
listExperimentsCallable
public final com.google.api.gax.rpc.UnaryCallable<ListExperimentsRequest,ListExperimentsResponse> listExperimentsCallable()
Returns the list of all experiments in the specified [Environment][google.cloud.dialogflow.cx.v3.Environment].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; } } }
-
getExperiment
public final Experiment getExperiment(ExperimentName name)
Retrieves the specified [Experiment][google.cloud.dialogflow.cx.v3.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()) { ExperimentName name = ExperimentName.of("[PROJECT]", "[LOCATION]", "[AGENT]", "[ENVIRONMENT]", "[EXPERIMENT]"); Experiment response = experimentsClient.getExperiment(name); }
- Parameters:
name
- Required. The name of the [Environment][google.cloud.dialogflow.cx.v3.Environment]. Format: `projects/<Project ID>/locations/<Location ID>/agents/<Agent ID>/environments/<Environment ID>/experiments/<Experiment ID>`.- Throws:
com.google.api.gax.rpc.ApiException
- if the remote call fails
-
getExperiment
public final Experiment getExperiment(String name)
Retrieves the specified [Experiment][google.cloud.dialogflow.cx.v3.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 name = ExperimentName.of("[PROJECT]", "[LOCATION]", "[AGENT]", "[ENVIRONMENT]", "[EXPERIMENT]") .toString(); Experiment response = experimentsClient.getExperiment(name); }
- Parameters:
name
- Required. The name of the [Environment][google.cloud.dialogflow.cx.v3.Environment]. Format: `projects/<Project ID>/locations/<Location ID>/agents/<Agent ID>/environments/<Environment ID>/experiments/<Experiment ID>`.- Throws:
com.google.api.gax.rpc.ApiException
- if the remote call fails
-
getExperiment
public final Experiment getExperiment(GetExperimentRequest request)
Retrieves the specified [Experiment][google.cloud.dialogflow.cx.v3.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()) { GetExperimentRequest request = GetExperimentRequest.newBuilder() .setName( ExperimentName.of( "[PROJECT]", "[LOCATION]", "[AGENT]", "[ENVIRONMENT]", "[EXPERIMENT]") .toString()) .build(); Experiment response = experimentsClient.getExperiment(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
-
getExperimentCallable
public final com.google.api.gax.rpc.UnaryCallable<GetExperimentRequest,Experiment> getExperimentCallable()
Retrieves the specified [Experiment][google.cloud.dialogflow.cx.v3.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()) { 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(); }
-
createExperiment
public final Experiment createExperiment(EnvironmentName parent, Experiment experiment)
Creates an [Experiment][google.cloud.dialogflow.cx.v3.Experiment] in the specified [Environment][google.cloud.dialogflow.cx.v3.Environment].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); }
- Parameters:
parent
- Required. The [Agent][google.cloud.dialogflow.cx.v3.Agent] to create an [Environment][google.cloud.dialogflow.cx.v3.Environment] for. Format: `projects/<Project ID>/locations/<Location ID>/agents/<Agent ID>/environments/<Environment ID>`.experiment
- Required. The experiment to create.- Throws:
com.google.api.gax.rpc.ApiException
- if the remote call fails
-
createExperiment
public final Experiment createExperiment(String parent, Experiment experiment)
Creates an [Experiment][google.cloud.dialogflow.cx.v3.Experiment] in the specified [Environment][google.cloud.dialogflow.cx.v3.Environment].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); }
- Parameters:
parent
- Required. The [Agent][google.cloud.dialogflow.cx.v3.Agent] to create an [Environment][google.cloud.dialogflow.cx.v3.Environment] for. Format: `projects/<Project ID>/locations/<Location ID>/agents/<Agent ID>/environments/<Environment ID>`.experiment
- Required. The experiment to create.- Throws:
com.google.api.gax.rpc.ApiException
- if the remote call fails
-
createExperiment
public final Experiment createExperiment(CreateExperimentRequest request)
Creates an [Experiment][google.cloud.dialogflow.cx.v3.Experiment] in the specified [Environment][google.cloud.dialogflow.cx.v3.Environment].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); }
- 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
-
createExperimentCallable
public final com.google.api.gax.rpc.UnaryCallable<CreateExperimentRequest,Experiment> createExperimentCallable()
Creates an [Experiment][google.cloud.dialogflow.cx.v3.Experiment] in the specified [Environment][google.cloud.dialogflow.cx.v3.Environment].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(); }
-
updateExperiment
public final Experiment updateExperiment(Experiment experiment, com.google.protobuf.FieldMask updateMask)
Updates the specified [Experiment][google.cloud.dialogflow.cx.v3.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()) { Experiment experiment = Experiment.newBuilder().build(); FieldMask updateMask = FieldMask.newBuilder().build(); Experiment response = experimentsClient.updateExperiment(experiment, updateMask); }
- Parameters:
experiment
- Required. The experiment to update.updateMask
- Required. The mask to control which fields get updated.- Throws:
com.google.api.gax.rpc.ApiException
- if the remote call fails
-
updateExperiment
public final Experiment updateExperiment(UpdateExperimentRequest request)
Updates the specified [Experiment][google.cloud.dialogflow.cx.v3.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()) { UpdateExperimentRequest request = UpdateExperimentRequest.newBuilder() .setExperiment(Experiment.newBuilder().build()) .setUpdateMask(FieldMask.newBuilder().build()) .build(); Experiment response = experimentsClient.updateExperiment(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
-
updateExperimentCallable
public final com.google.api.gax.rpc.UnaryCallable<UpdateExperimentRequest,Experiment> updateExperimentCallable()
Updates the specified [Experiment][google.cloud.dialogflow.cx.v3.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()) { 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(); }
-
deleteExperiment
public final void deleteExperiment(ExperimentName name)
Deletes the specified [Experiment][google.cloud.dialogflow.cx.v3.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()) { ExperimentName name = ExperimentName.of("[PROJECT]", "[LOCATION]", "[AGENT]", "[ENVIRONMENT]", "[EXPERIMENT]"); experimentsClient.deleteExperiment(name); }
- Parameters:
name
- Required. The name of the [Environment][google.cloud.dialogflow.cx.v3.Environment] to delete. Format: `projects/<Project ID>/locations/<Location ID>/agents/<Agent ID>/environments/<Environment ID>/experiments/<Experiment ID>`.- Throws:
com.google.api.gax.rpc.ApiException
- if the remote call fails
-
deleteExperiment
public final void deleteExperiment(String name)
Deletes the specified [Experiment][google.cloud.dialogflow.cx.v3.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 name = ExperimentName.of("[PROJECT]", "[LOCATION]", "[AGENT]", "[ENVIRONMENT]", "[EXPERIMENT]") .toString(); experimentsClient.deleteExperiment(name); }
- Parameters:
name
- Required. The name of the [Environment][google.cloud.dialogflow.cx.v3.Environment] to delete. Format: `projects/<Project ID>/locations/<Location ID>/agents/<Agent ID>/environments/<Environment ID>/experiments/<Experiment ID>`.- Throws:
com.google.api.gax.rpc.ApiException
- if the remote call fails
-
deleteExperiment
public final void deleteExperiment(DeleteExperimentRequest request)
Deletes the specified [Experiment][google.cloud.dialogflow.cx.v3.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()) { DeleteExperimentRequest request = DeleteExperimentRequest.newBuilder() .setName( ExperimentName.of( "[PROJECT]", "[LOCATION]", "[AGENT]", "[ENVIRONMENT]", "[EXPERIMENT]") .toString()) .build(); experimentsClient.deleteExperiment(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
-
deleteExperimentCallable
public final com.google.api.gax.rpc.UnaryCallable<DeleteExperimentRequest,com.google.protobuf.Empty> deleteExperimentCallable()
Deletes the specified [Experiment][google.cloud.dialogflow.cx.v3.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()) { 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(); }
-
startExperiment
public final Experiment startExperiment(ExperimentName name)
Starts the specified [Experiment][google.cloud.dialogflow.cx.v3.Experiment]. This rpc only changes the state of experiment from PENDING to RUNNING.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); }
- Parameters:
name
- Required. Resource name of the experiment to start. Format: `projects/<Project ID>/locations/<Location ID>/agents/<Agent ID>/environments/<Environment ID>/experiments/<Experiment ID>`.- Throws:
com.google.api.gax.rpc.ApiException
- if the remote call fails
-
startExperiment
public final Experiment startExperiment(String name)
Starts the specified [Experiment][google.cloud.dialogflow.cx.v3.Experiment]. This rpc only changes the state of experiment from PENDING to RUNNING.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); }
- Parameters:
name
- Required. Resource name of the experiment to start. Format: `projects/<Project ID>/locations/<Location ID>/agents/<Agent ID>/environments/<Environment ID>/experiments/<Experiment ID>`.- Throws:
com.google.api.gax.rpc.ApiException
- if the remote call fails
-
startExperiment
public final Experiment startExperiment(StartExperimentRequest request)
Starts the specified [Experiment][google.cloud.dialogflow.cx.v3.Experiment]. This rpc only changes the state of experiment from PENDING to RUNNING.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); }
- 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
-
startExperimentCallable
public final com.google.api.gax.rpc.UnaryCallable<StartExperimentRequest,Experiment> startExperimentCallable()
Starts the specified [Experiment][google.cloud.dialogflow.cx.v3.Experiment]. This rpc only changes the state of experiment from PENDING to RUNNING.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(); }
-
stopExperiment
public final Experiment stopExperiment(ExperimentName name)
Stops the specified [Experiment][google.cloud.dialogflow.cx.v3.Experiment]. This rpc only changes the state of experiment from RUNNING to DONE.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); }
- Parameters:
name
- Required. Resource name of the experiment to stop. Format: `projects/<Project ID>/locations/<Location ID>/agents/<Agent ID>/environments/<Environment ID>/experiments/<Experiment ID>`.- Throws:
com.google.api.gax.rpc.ApiException
- if the remote call fails
-
stopExperiment
public final Experiment stopExperiment(String name)
Stops the specified [Experiment][google.cloud.dialogflow.cx.v3.Experiment]. This rpc only changes the state of experiment from RUNNING to DONE.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); }
- Parameters:
name
- Required. Resource name of the experiment to stop. Format: `projects/<Project ID>/locations/<Location ID>/agents/<Agent ID>/environments/<Environment ID>/experiments/<Experiment ID>`.- Throws:
com.google.api.gax.rpc.ApiException
- if the remote call fails
-
stopExperiment
public final Experiment stopExperiment(StopExperimentRequest request)
Stops the specified [Experiment][google.cloud.dialogflow.cx.v3.Experiment]. This rpc only changes the state of experiment from RUNNING to DONE.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); }
- 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
-
stopExperimentCallable
public final com.google.api.gax.rpc.UnaryCallable<StopExperimentRequest,Experiment> stopExperimentCallable()
Stops the specified [Experiment][google.cloud.dialogflow.cx.v3.Experiment]. This rpc only changes the state of experiment from RUNNING to DONE.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(); }
-
listLocations
public final ExperimentsClient.ListLocationsPagedResponse listLocations(com.google.cloud.location.ListLocationsRequest request)
Lists information about the supported locations for this service.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); } }
- 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
-
listLocationsPagedCallable
public final com.google.api.gax.rpc.UnaryCallable<com.google.cloud.location.ListLocationsRequest,ExperimentsClient.ListLocationsPagedResponse> listLocationsPagedCallable()
Lists information about the supported locations for this service.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); } }
-
listLocationsCallable
public final 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.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; } } }
-
getLocation
public final com.google.cloud.location.Location getLocation(com.google.cloud.location.GetLocationRequest request)
Gets information about a location.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); }
- 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
-
getLocationCallable
public final com.google.api.gax.rpc.UnaryCallable<com.google.cloud.location.GetLocationRequest,com.google.cloud.location.Location> getLocationCallable()
Gets information about a location.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(); }
-
close
public final void close()
- Specified by:
close
in interfaceAutoCloseable
-
shutdown
public void shutdown()
- Specified by:
shutdown
in interfacecom.google.api.gax.core.BackgroundResource
-
isShutdown
public boolean isShutdown()
- Specified by:
isShutdown
in interfacecom.google.api.gax.core.BackgroundResource
-
isTerminated
public boolean isTerminated()
- Specified by:
isTerminated
in interfacecom.google.api.gax.core.BackgroundResource
-
shutdownNow
public void shutdownNow()
- Specified by:
shutdownNow
in interfacecom.google.api.gax.core.BackgroundResource
-
awaitTermination
public boolean awaitTermination(long duration, TimeUnit unit) throws InterruptedException
- Specified by:
awaitTermination
in interfacecom.google.api.gax.core.BackgroundResource
- Throws:
InterruptedException
-
-