This class provides the ability to make remote calls to the backing service through method + * calls that map to API methods. Sample code to get started: + * + *
+ *
+ * try (AgentsClient agentsClient = AgentsClient.create()) {
+ * AgentName name = AgentName.of("[PROJECT]", "[LOCATION]", "[AGENT]");
+ * Agent response = agentsClient.getAgent(name);
+ * }
+ *
+ *
+ *
+ * Note: close() needs to be called on the agentsClient 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: + * + *
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 AgentsSettings to create(). + * For example: + * + *
To customize credentials: + * + *
+ *
+ * AgentsSettings agentsSettings =
+ * AgentsSettings.newBuilder()
+ * .setCredentialsProvider(FixedCredentialsProvider.create(myCredentials))
+ * .build();
+ * AgentsClient agentsClient =
+ * AgentsClient.create(agentsSettings);
+ *
+ *
+ *
+ * To customize the endpoint:
+ *
+ *
+ *
+ * AgentsSettings agentsSettings =
+ * AgentsSettings.newBuilder().setEndpoint(myEndpoint).build();
+ * AgentsClient agentsClient =
+ * AgentsClient.create(agentsSettings);
+ *
+ *
+ */
+@Generated("by gapic-generator")
+public class AgentsClient implements BackgroundResource {
+ private final AgentsSettings settings;
+ private final AgentsStub stub;
+ private final OperationsClient operationsClient;
+
+ /** Constructs an instance of AgentsClient with default settings. */
+ public static final AgentsClient create() throws IOException {
+ return create(AgentsSettings.newBuilder().build());
+ }
+
+ /**
+ * Constructs an instance of AgentsClient, using the given settings. The channels are created
+ * based on the settings passed in, or defaults for any settings that are not set.
+ */
+ public static final AgentsClient create(AgentsSettings settings) throws IOException {
+ return new AgentsClient(settings);
+ }
+
+ /**
+ * Constructs an instance of AgentsClient, using the given stub for making calls. This is for
+ * advanced usage - prefer to use AgentsSettings}.
+ */
+ @BetaApi("A restructuring of stub classes is planned, so this may break in the future")
+ public static final AgentsClient create(AgentsStub stub) {
+ return new AgentsClient(stub);
+ }
+
+ /**
+ * Constructs an instance of AgentsClient, 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.
+ */
+ protected AgentsClient(AgentsSettings settings) throws IOException {
+ this.settings = settings;
+ this.stub = ((AgentsStubSettings) settings.getStubSettings()).createStub();
+ this.operationsClient = OperationsClient.create(this.stub.getOperationsStub());
+ }
+
+ @BetaApi("A restructuring of stub classes is planned, so this may break in the future")
+ protected AgentsClient(AgentsStub stub) {
+ this.settings = null;
+ this.stub = stub;
+ this.operationsClient = OperationsClient.create(this.stub.getOperationsStub());
+ }
+
+ public final AgentsSettings getSettings() {
+ return settings;
+ }
+
+ @BetaApi("A restructuring of stub classes is planned, so this may break in the future")
+ public AgentsStub getStub() {
+ return stub;
+ }
+
+ /**
+ * Returns the OperationsClient that can be used to query the status of a long-running operation
+ * returned by another API method call.
+ */
+ @BetaApi(
+ "The surface for long-running operations is not stable yet and may change in the future.")
+ public final OperationsClient getOperationsClient() {
+ return operationsClient;
+ }
+
+ // AUTO-GENERATED DOCUMENTATION AND METHOD
+ /**
+ * Returns the list of all agents in the specified location.
+ *
+ * Sample code: + * + *
+ * try (AgentsClient agentsClient = AgentsClient.create()) {
+ * LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]");
+ * for (Agent element : agentsClient.listAgents(parent).iterateAll()) {
+ * // doThingsWith(element);
+ * }
+ * }
+ *
+ *
+ * @param parent Required. The location to list all agents for. Format: `projects/<Project
+ * ID>/locations/<Location ID>`.
+ * @throws com.google.api.gax.rpc.ApiException if the remote call fails
+ */
+ public final ListAgentsPagedResponse listAgents(LocationName parent) {
+ ListAgentsRequest request =
+ ListAgentsRequest.newBuilder().setParent(parent == null ? null : parent.toString()).build();
+ return listAgents(request);
+ }
+
+ // AUTO-GENERATED DOCUMENTATION AND METHOD
+ /**
+ * Returns the list of all agents in the specified location.
+ *
+ * Sample code: + * + *
+ * try (AgentsClient agentsClient = AgentsClient.create()) {
+ * LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]");
+ * for (Agent element : agentsClient.listAgents(parent.toString()).iterateAll()) {
+ * // doThingsWith(element);
+ * }
+ * }
+ *
+ *
+ * @param parent Required. The location to list all agents for. Format: `projects/<Project
+ * ID>/locations/<Location ID>`.
+ * @throws com.google.api.gax.rpc.ApiException if the remote call fails
+ */
+ public final ListAgentsPagedResponse listAgents(String parent) {
+ ListAgentsRequest request = ListAgentsRequest.newBuilder().setParent(parent).build();
+ return listAgents(request);
+ }
+
+ // AUTO-GENERATED DOCUMENTATION AND METHOD
+ /**
+ * Returns the list of all agents in the specified location.
+ *
+ * Sample code: + * + *
+ * try (AgentsClient agentsClient = AgentsClient.create()) {
+ * LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]");
+ * ListAgentsRequest request = ListAgentsRequest.newBuilder()
+ * .setParent(parent.toString())
+ * .build();
+ * for (Agent element : agentsClient.listAgents(request).iterateAll()) {
+ * // doThingsWith(element);
+ * }
+ * }
+ *
+ *
+ * @param 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
+ */
+ public final ListAgentsPagedResponse listAgents(ListAgentsRequest request) {
+ return listAgentsPagedCallable().call(request);
+ }
+
+ // AUTO-GENERATED DOCUMENTATION AND METHOD
+ /**
+ * Returns the list of all agents in the specified location.
+ *
+ * Sample code: + * + *
+ * try (AgentsClient agentsClient = AgentsClient.create()) {
+ * LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]");
+ * ListAgentsRequest request = ListAgentsRequest.newBuilder()
+ * .setParent(parent.toString())
+ * .build();
+ * ApiFuture<ListAgentsPagedResponse> future = agentsClient.listAgentsPagedCallable().futureCall(request);
+ * // Do something
+ * for (Agent element : future.get().iterateAll()) {
+ * // doThingsWith(element);
+ * }
+ * }
+ *
+ */
+ public final UnaryCallableSample code: + * + *
+ * try (AgentsClient agentsClient = AgentsClient.create()) {
+ * LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]");
+ * ListAgentsRequest request = ListAgentsRequest.newBuilder()
+ * .setParent(parent.toString())
+ * .build();
+ * while (true) {
+ * ListAgentsResponse response = agentsClient.listAgentsCallable().call(request);
+ * for (Agent element : response.getAgentsList()) {
+ * // doThingsWith(element);
+ * }
+ * String nextPageToken = response.getNextPageToken();
+ * if (!Strings.isNullOrEmpty(nextPageToken)) {
+ * request = request.toBuilder().setPageToken(nextPageToken).build();
+ * } else {
+ * break;
+ * }
+ * }
+ * }
+ *
+ */
+ public final UnaryCallableSample code: + * + *
+ * try (AgentsClient agentsClient = AgentsClient.create()) {
+ * AgentName name = AgentName.of("[PROJECT]", "[LOCATION]", "[AGENT]");
+ * Agent response = agentsClient.getAgent(name);
+ * }
+ *
+ *
+ * @param name Required. The name of the agent. Format: `projects/<Project
+ * ID>/locations/<Location ID>/agents/<Agent ID>`.
+ * @throws com.google.api.gax.rpc.ApiException if the remote call fails
+ */
+ public final Agent getAgent(AgentName name) {
+ GetAgentRequest request =
+ GetAgentRequest.newBuilder().setName(name == null ? null : name.toString()).build();
+ return getAgent(request);
+ }
+
+ // AUTO-GENERATED DOCUMENTATION AND METHOD
+ /**
+ * Retrieves the specified agent.
+ *
+ * Sample code: + * + *
+ * try (AgentsClient agentsClient = AgentsClient.create()) {
+ * AgentName name = AgentName.of("[PROJECT]", "[LOCATION]", "[AGENT]");
+ * Agent response = agentsClient.getAgent(name.toString());
+ * }
+ *
+ *
+ * @param name Required. The name of the agent. Format: `projects/<Project
+ * ID>/locations/<Location ID>/agents/<Agent ID>`.
+ * @throws com.google.api.gax.rpc.ApiException if the remote call fails
+ */
+ public final Agent getAgent(String name) {
+ GetAgentRequest request = GetAgentRequest.newBuilder().setName(name).build();
+ return getAgent(request);
+ }
+
+ // AUTO-GENERATED DOCUMENTATION AND METHOD
+ /**
+ * Retrieves the specified agent.
+ *
+ * Sample code: + * + *
+ * try (AgentsClient agentsClient = AgentsClient.create()) {
+ * AgentName name = AgentName.of("[PROJECT]", "[LOCATION]", "[AGENT]");
+ * GetAgentRequest request = GetAgentRequest.newBuilder()
+ * .setName(name.toString())
+ * .build();
+ * Agent response = agentsClient.getAgent(request);
+ * }
+ *
+ *
+ * @param 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
+ */
+ public final Agent getAgent(GetAgentRequest request) {
+ return getAgentCallable().call(request);
+ }
+
+ // AUTO-GENERATED DOCUMENTATION AND METHOD
+ /**
+ * Retrieves the specified agent.
+ *
+ * Sample code: + * + *
+ * try (AgentsClient agentsClient = AgentsClient.create()) {
+ * AgentName name = AgentName.of("[PROJECT]", "[LOCATION]", "[AGENT]");
+ * GetAgentRequest request = GetAgentRequest.newBuilder()
+ * .setName(name.toString())
+ * .build();
+ * ApiFuture<Agent> future = agentsClient.getAgentCallable().futureCall(request);
+ * // Do something
+ * Agent response = future.get();
+ * }
+ *
+ */
+ public final UnaryCallableSample code: + * + *
+ * try (AgentsClient agentsClient = AgentsClient.create()) {
+ * LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]");
+ * Agent agent = Agent.newBuilder().build();
+ * Agent response = agentsClient.createAgent(parent, agent);
+ * }
+ *
+ *
+ * @param parent Required. The location to create a agent for. Format: `projects/<Project
+ * ID>/locations/<Location ID>`.
+ * @param agent Required. The agent to create.
+ * @throws com.google.api.gax.rpc.ApiException if the remote call fails
+ */
+ public final Agent createAgent(LocationName parent, Agent agent) {
+ CreateAgentRequest request =
+ CreateAgentRequest.newBuilder()
+ .setParent(parent == null ? null : parent.toString())
+ .setAgent(agent)
+ .build();
+ return createAgent(request);
+ }
+
+ // AUTO-GENERATED DOCUMENTATION AND METHOD
+ /**
+ * Creates an agent in the specified location.
+ *
+ * Sample code: + * + *
+ * try (AgentsClient agentsClient = AgentsClient.create()) {
+ * LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]");
+ * Agent agent = Agent.newBuilder().build();
+ * Agent response = agentsClient.createAgent(parent.toString(), agent);
+ * }
+ *
+ *
+ * @param parent Required. The location to create a agent for. Format: `projects/<Project
+ * ID>/locations/<Location ID>`.
+ * @param agent Required. The agent to create.
+ * @throws com.google.api.gax.rpc.ApiException if the remote call fails
+ */
+ public final Agent createAgent(String parent, Agent agent) {
+ CreateAgentRequest request =
+ CreateAgentRequest.newBuilder().setParent(parent).setAgent(agent).build();
+ return createAgent(request);
+ }
+
+ // AUTO-GENERATED DOCUMENTATION AND METHOD
+ /**
+ * Creates an agent in the specified location.
+ *
+ * Sample code: + * + *
+ * try (AgentsClient agentsClient = AgentsClient.create()) {
+ * LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]");
+ * Agent agent = Agent.newBuilder().build();
+ * CreateAgentRequest request = CreateAgentRequest.newBuilder()
+ * .setParent(parent.toString())
+ * .setAgent(agent)
+ * .build();
+ * Agent response = agentsClient.createAgent(request);
+ * }
+ *
+ *
+ * @param 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
+ */
+ public final Agent createAgent(CreateAgentRequest request) {
+ return createAgentCallable().call(request);
+ }
+
+ // AUTO-GENERATED DOCUMENTATION AND METHOD
+ /**
+ * Creates an agent in the specified location.
+ *
+ * Sample code: + * + *
+ * try (AgentsClient agentsClient = AgentsClient.create()) {
+ * LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]");
+ * Agent agent = Agent.newBuilder().build();
+ * CreateAgentRequest request = CreateAgentRequest.newBuilder()
+ * .setParent(parent.toString())
+ * .setAgent(agent)
+ * .build();
+ * ApiFuture<Agent> future = agentsClient.createAgentCallable().futureCall(request);
+ * // Do something
+ * Agent response = future.get();
+ * }
+ *
+ */
+ public final UnaryCallableSample code: + * + *
+ * try (AgentsClient agentsClient = AgentsClient.create()) {
+ * Agent agent = Agent.newBuilder().build();
+ * FieldMask updateMask = FieldMask.newBuilder().build();
+ * Agent response = agentsClient.updateAgent(agent, updateMask);
+ * }
+ *
+ *
+ * @param agent Required. The agent to update.
+ * @param updateMask The mask to control which fields get updated. If the mask is not present, all
+ * fields will be updated.
+ * @throws com.google.api.gax.rpc.ApiException if the remote call fails
+ */
+ public final Agent updateAgent(Agent agent, FieldMask updateMask) {
+ UpdateAgentRequest request =
+ UpdateAgentRequest.newBuilder().setAgent(agent).setUpdateMask(updateMask).build();
+ return updateAgent(request);
+ }
+
+ // AUTO-GENERATED DOCUMENTATION AND METHOD
+ /**
+ * Updates the specified agent.
+ *
+ * Sample code: + * + *
+ * try (AgentsClient agentsClient = AgentsClient.create()) {
+ * Agent agent = Agent.newBuilder().build();
+ * UpdateAgentRequest request = UpdateAgentRequest.newBuilder()
+ * .setAgent(agent)
+ * .build();
+ * Agent response = agentsClient.updateAgent(request);
+ * }
+ *
+ *
+ * @param 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
+ */
+ public final Agent updateAgent(UpdateAgentRequest request) {
+ return updateAgentCallable().call(request);
+ }
+
+ // AUTO-GENERATED DOCUMENTATION AND METHOD
+ /**
+ * Updates the specified agent.
+ *
+ * Sample code: + * + *
+ * try (AgentsClient agentsClient = AgentsClient.create()) {
+ * Agent agent = Agent.newBuilder().build();
+ * UpdateAgentRequest request = UpdateAgentRequest.newBuilder()
+ * .setAgent(agent)
+ * .build();
+ * ApiFuture<Agent> future = agentsClient.updateAgentCallable().futureCall(request);
+ * // Do something
+ * Agent response = future.get();
+ * }
+ *
+ */
+ public final UnaryCallableSample code: + * + *
+ * try (AgentsClient agentsClient = AgentsClient.create()) {
+ * AgentName name = AgentName.of("[PROJECT]", "[LOCATION]", "[AGENT]");
+ * agentsClient.deleteAgent(name);
+ * }
+ *
+ *
+ * @param name Required. The name of the agent to delete. Format: `projects/<Project
+ * ID>/locations/<Location ID>/agents/<Agent ID>`.
+ * @throws com.google.api.gax.rpc.ApiException if the remote call fails
+ */
+ public final void deleteAgent(AgentName name) {
+ DeleteAgentRequest request =
+ DeleteAgentRequest.newBuilder().setName(name == null ? null : name.toString()).build();
+ deleteAgent(request);
+ }
+
+ // AUTO-GENERATED DOCUMENTATION AND METHOD
+ /**
+ * Deletes the specified agent.
+ *
+ * Sample code: + * + *
+ * try (AgentsClient agentsClient = AgentsClient.create()) {
+ * AgentName name = AgentName.of("[PROJECT]", "[LOCATION]", "[AGENT]");
+ * agentsClient.deleteAgent(name.toString());
+ * }
+ *
+ *
+ * @param name Required. The name of the agent to delete. Format: `projects/<Project
+ * ID>/locations/<Location ID>/agents/<Agent ID>`.
+ * @throws com.google.api.gax.rpc.ApiException if the remote call fails
+ */
+ public final void deleteAgent(String name) {
+ DeleteAgentRequest request = DeleteAgentRequest.newBuilder().setName(name).build();
+ deleteAgent(request);
+ }
+
+ // AUTO-GENERATED DOCUMENTATION AND METHOD
+ /**
+ * Deletes the specified agent.
+ *
+ * Sample code: + * + *
+ * try (AgentsClient agentsClient = AgentsClient.create()) {
+ * AgentName name = AgentName.of("[PROJECT]", "[LOCATION]", "[AGENT]");
+ * DeleteAgentRequest request = DeleteAgentRequest.newBuilder()
+ * .setName(name.toString())
+ * .build();
+ * agentsClient.deleteAgent(request);
+ * }
+ *
+ *
+ * @param 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
+ */
+ public final void deleteAgent(DeleteAgentRequest request) {
+ deleteAgentCallable().call(request);
+ }
+
+ // AUTO-GENERATED DOCUMENTATION AND METHOD
+ /**
+ * Deletes the specified agent.
+ *
+ * Sample code: + * + *
+ * try (AgentsClient agentsClient = AgentsClient.create()) {
+ * AgentName name = AgentName.of("[PROJECT]", "[LOCATION]", "[AGENT]");
+ * DeleteAgentRequest request = DeleteAgentRequest.newBuilder()
+ * .setName(name.toString())
+ * .build();
+ * ApiFuture<Void> future = agentsClient.deleteAgentCallable().futureCall(request);
+ * // Do something
+ * future.get();
+ * }
+ *
+ */
+ public final UnaryCallableSample code: + * + *
+ * try (AgentsClient agentsClient = AgentsClient.create()) {
+ * AgentName name = AgentName.of("[PROJECT]", "[LOCATION]", "[AGENT]");
+ * ExportAgentRequest request = ExportAgentRequest.newBuilder()
+ * .setName(name.toString())
+ * .build();
+ * ExportAgentResponse response = agentsClient.exportAgentAsync(request).get();
+ * }
+ *
+ *
+ * @param 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
+ */
+ @BetaApi(
+ "The surface for long-running operations is not stable yet and may change in the future.")
+ public final OperationFutureSample code: + * + *
+ * try (AgentsClient agentsClient = AgentsClient.create()) {
+ * AgentName name = AgentName.of("[PROJECT]", "[LOCATION]", "[AGENT]");
+ * ExportAgentRequest request = ExportAgentRequest.newBuilder()
+ * .setName(name.toString())
+ * .build();
+ * OperationFuture<ExportAgentResponse, Struct> future = agentsClient.exportAgentOperationCallable().futureCall(request);
+ * // Do something
+ * ExportAgentResponse response = future.get();
+ * }
+ *
+ */
+ @BetaApi("The surface for use by generated code is not stable yet and may change in the future.")
+ public final OperationCallableSample code: + * + *
+ * try (AgentsClient agentsClient = AgentsClient.create()) {
+ * AgentName name = AgentName.of("[PROJECT]", "[LOCATION]", "[AGENT]");
+ * ExportAgentRequest request = ExportAgentRequest.newBuilder()
+ * .setName(name.toString())
+ * .build();
+ * ApiFuture<Operation> future = agentsClient.exportAgentCallable().futureCall(request);
+ * // Do something
+ * Operation response = future.get();
+ * }
+ *
+ */
+ public final UnaryCallableReplaces the current agent with a new one. Note that all existing resources in agent (e.g. + * intents, entity types, flows) will be removed. + * + *
Sample code: + * + *
+ * try (AgentsClient agentsClient = AgentsClient.create()) {
+ * AgentName name = AgentName.of("[PROJECT]", "[LOCATION]", "[AGENT]");
+ * RestoreAgentRequest request = RestoreAgentRequest.newBuilder()
+ * .setName(name.toString())
+ * .build();
+ * agentsClient.restoreAgentAsync(request).get();
+ * }
+ *
+ *
+ * @param 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
+ */
+ @BetaApi(
+ "The surface for long-running operations is not stable yet and may change in the future.")
+ public final OperationFutureReplaces the current agent with a new one. Note that all existing resources in agent (e.g. + * intents, entity types, flows) will be removed. + * + *
Sample code: + * + *
+ * try (AgentsClient agentsClient = AgentsClient.create()) {
+ * AgentName name = AgentName.of("[PROJECT]", "[LOCATION]", "[AGENT]");
+ * RestoreAgentRequest request = RestoreAgentRequest.newBuilder()
+ * .setName(name.toString())
+ * .build();
+ * OperationFuture<Empty, Struct> future = agentsClient.restoreAgentOperationCallable().futureCall(request);
+ * // Do something
+ * future.get();
+ * }
+ *
+ */
+ @BetaApi("The surface for use by generated code is not stable yet and may change in the future.")
+ public final OperationCallableReplaces the current agent with a new one. Note that all existing resources in agent (e.g. + * intents, entity types, flows) will be removed. + * + *
Sample code: + * + *
+ * try (AgentsClient agentsClient = AgentsClient.create()) {
+ * AgentName name = AgentName.of("[PROJECT]", "[LOCATION]", "[AGENT]");
+ * RestoreAgentRequest request = RestoreAgentRequest.newBuilder()
+ * .setName(name.toString())
+ * .build();
+ * ApiFuture<Operation> future = agentsClient.restoreAgentCallable().futureCall(request);
+ * // Do something
+ * future.get();
+ * }
+ *
+ */
+ public final UnaryCallableThe default instance has everything set to sensible defaults: + * + *
The builder of this class is recursive, so contained classes are themselves builders. When + * build() is called, the tree of builders is called to create the complete settings object. + * + *
For example, to set the total timeout of getAgent to 30 seconds: + * + *
+ *
+ * AgentsSettings.Builder agentsSettingsBuilder =
+ * AgentsSettings.newBuilder();
+ * agentsSettingsBuilder
+ * .getAgentSettings()
+ * .setRetrySettings(
+ * agentsSettingsBuilder.getAgentSettings().getRetrySettings().toBuilder()
+ * .setTotalTimeout(Duration.ofSeconds(30))
+ * .build());
+ * AgentsSettings agentsSettings = agentsSettingsBuilder.build();
+ *
+ *
+ */
+@Generated("by gapic-generator")
+public class AgentsSettings extends ClientSettingsNote: This method does not support applying settings to streaming methods.
+ */
+ public Builder applyToAllUnaryMethods(
+ ApiFunction 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:
+ *
+ * Note: close() needs to be called on the entityTypesClient 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:
+ *
+ * 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 EntityTypesSettings to
+ * create(). For example:
+ *
+ * To customize credentials:
+ *
+ * Sample code:
+ *
+ * Sample code:
+ *
+ * Sample code:
+ *
+ * Sample code:
+ *
+ * Sample code:
+ *
+ * Sample code:
+ *
+ * Sample code:
+ *
+ * Sample code:
+ *
+ * Sample code:
+ *
+ * Sample code:
+ *
+ * Sample code:
+ *
+ * Sample code:
+ *
+ * Sample code:
+ *
+ * Sample code:
+ *
+ * Sample code:
+ *
+ * Sample code:
+ *
+ * Sample code:
+ *
+ * Sample code:
+ *
+ * Sample code:
+ *
+ * Sample code:
+ *
+ * The default instance has everything set to sensible defaults:
+ *
+ * The builder of this class is recursive, so contained classes are themselves builders. When
+ * build() is called, the tree of builders is called to create the complete settings object.
+ *
+ * For example, to set the total timeout of getEntityType to 30 seconds:
+ *
+ * Note: This method does not support applying settings to streaming methods.
+ */
+ public Builder applyToAllUnaryMethods(
+ ApiFunction 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:
+ *
+ * Note: close() needs to be called on the environmentsClient 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:
+ *
+ * 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 EnvironmentsSettings to
+ * create(). For example:
+ *
+ * To customize credentials:
+ *
+ * Sample code:
+ *
+ * Sample code:
+ *
+ * Sample code:
+ *
+ * Sample code:
+ *
+ * Sample code:
+ *
+ * Sample code:
+ *
+ * Sample code:
+ *
+ * Sample code:
+ *
+ * Sample code:
+ *
+ * Sample code:
+ *
+ * Sample code:
+ *
+ * Sample code:
+ *
+ * Sample code:
+ *
+ * Sample code:
+ *
+ * Sample code:
+ *
+ * Sample code:
+ *
+ * Sample code:
+ *
+ * Sample code:
+ *
+ * Sample code:
+ *
+ * Sample code:
+ *
+ * Sample code:
+ *
+ * Sample code:
+ *
+ * Sample code:
+ *
+ * Sample code:
+ *
+ * Sample code:
+ *
+ * Sample code:
+ *
+ * Sample code:
+ *
+ * The default instance has everything set to sensible defaults:
+ *
+ * The builder of this class is recursive, so contained classes are themselves builders. When
+ * build() is called, the tree of builders is called to create the complete settings object.
+ *
+ * For example, to set the total timeout of getEnvironment to 30 seconds:
+ *
+ * Note: This method does not support applying settings to streaming methods.
+ */
+ public Builder applyToAllUnaryMethods(
+ ApiFunction 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:
+ *
+ * Note: close() needs to be called on the flowsClient 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:
+ *
+ * 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 FlowsSettings to create(). For
+ * example:
+ *
+ * To customize credentials:
+ *
+ * Sample code:
+ *
+ * Sample code:
+ *
+ * Sample code:
+ *
+ * Sample code:
+ *
+ * Sample code:
+ *
+ * Sample code:
+ *
+ * Sample code:
+ *
+ * Sample code:
+ *
+ * Sample code:
+ *
+ * Sample code:
+ *
+ * Sample code:
+ *
+ * Sample code:
+ *
+ * Sample code:
+ *
+ * Sample code:
+ *
+ * Sample code:
+ *
+ * Sample code:
+ *
+ * Sample code:
+ *
+ * Sample code:
+ *
+ * Sample code:
+ *
+ * Sample code:
+ *
+ * Sample code:
+ *
+ * Sample code:
+ *
+ * Sample code:
+ *
+ * Sample code:
+ *
+ * Sample code:
+ *
+ * The default instance has everything set to sensible defaults:
+ *
+ * The builder of this class is recursive, so contained classes are themselves builders. When
+ * build() is called, the tree of builders is called to create the complete settings object.
+ *
+ * For example, to set the total timeout of createFlow to 30 seconds:
+ *
+ * Note: This method does not support applying settings to streaming methods.
+ */
+ public Builder applyToAllUnaryMethods(
+ ApiFunction 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:
+ *
+ * Note: close() needs to be called on the intentsClient 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:
+ *
+ * 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 IntentsSettings to create().
+ * For example:
+ *
+ * To customize credentials:
+ *
+ * Sample code:
+ *
+ * Sample code:
+ *
+ * Sample code:
+ *
+ * Sample code:
+ *
+ * Sample code:
+ *
+ * Sample code:
+ *
+ * Sample code:
+ *
+ * Sample code:
+ *
+ * Sample code:
+ *
+ * Sample code:
+ *
+ * Sample code:
+ *
+ * Sample code:
+ *
+ * Sample code:
+ *
+ * Sample code:
+ *
+ * Sample code:
+ *
+ * Sample code:
+ *
+ * Sample code:
+ *
+ * Sample code:
+ *
+ * Sample code:
+ *
+ * Sample code:
+ *
+ * The default instance has everything set to sensible defaults:
+ *
+ * The builder of this class is recursive, so contained classes are themselves builders. When
+ * build() is called, the tree of builders is called to create the complete settings object.
+ *
+ * For example, to set the total timeout of getIntent to 30 seconds:
+ *
+ * Note: This method does not support applying settings to streaming methods.
+ */
+ public Builder applyToAllUnaryMethods(
+ ApiFunction 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:
+ *
+ * Note: close() needs to be called on the pagesClient 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:
+ *
+ * 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 PagesSettings to create(). For
+ * example:
+ *
+ * To customize credentials:
+ *
+ * Sample code:
+ *
+ * Sample code:
+ *
+ * Sample code:
+ *
+ * Sample code:
+ *
+ * Sample code:
+ *
+ * Sample code:
+ *
+ * Sample code:
+ *
+ * Sample code:
+ *
+ * Sample code:
+ *
+ * Sample code:
+ *
+ * Sample code:
+ *
+ * Sample code:
+ *
+ * Sample code:
+ *
+ * Sample code:
+ *
+ * Sample code:
+ *
+ * Sample code:
+ *
+ * Sample code:
+ *
+ * Sample code:
+ *
+ * Sample code:
+ *
+ * Sample code:
+ *
+ * The default instance has everything set to sensible defaults:
+ *
+ * The builder of this class is recursive, so contained classes are themselves builders. When
+ * build() is called, the tree of builders is called to create the complete settings object.
+ *
+ * For example, to set the total timeout of getPage to 30 seconds:
+ *
+ * Note: This method does not support applying settings to streaming methods.
+ */
+ public Builder applyToAllUnaryMethods(
+ ApiFunction 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:
+ *
+ * Note: close() needs to be called on the securitySettingsServiceClient 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:
+ *
+ * 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
+ * SecuritySettingsServiceSettings to create(). For example:
+ *
+ * To customize credentials:
+ *
+ * Sample code:
+ *
+ * Sample code:
+ *
+ * Sample code:
+ *
+ * Sample code:
+ *
+ * Sample code:
+ *
+ * Sample code:
+ *
+ * Sample code:
+ *
+ * Sample code:
+ *
+ * Sample code:
+ *
+ * Sample code:
+ *
+ * Sample code:
+ *
+ * Sample code:
+ *
+ * Sample code:
+ *
+ * Sample code:
+ *
+ * Sample code:
+ *
+ * Sample code:
+ *
+ * Sample code:
+ *
+ * Sample code:
+ *
+ * Sample code:
+ *
+ * Sample code:
+ *
+ *
+ *
+ *
+ *
+ * try (EntityTypesClient entityTypesClient = EntityTypesClient.create()) {
+ * EntityTypeName name = EntityTypeName.of("[PROJECT]", "[LOCATION]", "[AGENT]", "[ENTITY_TYPE]");
+ * EntityType response = entityTypesClient.getEntityType(name);
+ * }
+ *
+ *
+ *
+ *
+ *
+ *
+ *
+ * To customize the endpoint:
+ *
+ *
+ * EntityTypesSettings entityTypesSettings =
+ * EntityTypesSettings.newBuilder()
+ * .setCredentialsProvider(FixedCredentialsProvider.create(myCredentials))
+ * .build();
+ * EntityTypesClient entityTypesClient =
+ * EntityTypesClient.create(entityTypesSettings);
+ *
+ *
+ *
+ */
+@Generated("by gapic-generator")
+public class EntityTypesClient implements BackgroundResource {
+ private final EntityTypesSettings settings;
+ private final EntityTypesStub stub;
+
+ /** Constructs an instance of EntityTypesClient with default settings. */
+ public static final EntityTypesClient create() throws IOException {
+ return create(EntityTypesSettings.newBuilder().build());
+ }
+
+ /**
+ * Constructs an instance of EntityTypesClient, using the given settings. The channels are created
+ * based on the settings passed in, or defaults for any settings that are not set.
+ */
+ public static final EntityTypesClient create(EntityTypesSettings settings) throws IOException {
+ return new EntityTypesClient(settings);
+ }
+
+ /**
+ * Constructs an instance of EntityTypesClient, using the given stub for making calls. This is for
+ * advanced usage - prefer to use EntityTypesSettings}.
+ */
+ @BetaApi("A restructuring of stub classes is planned, so this may break in the future")
+ public static final EntityTypesClient create(EntityTypesStub stub) {
+ return new EntityTypesClient(stub);
+ }
+
+ /**
+ * Constructs an instance of EntityTypesClient, 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.
+ */
+ protected EntityTypesClient(EntityTypesSettings settings) throws IOException {
+ this.settings = settings;
+ this.stub = ((EntityTypesStubSettings) settings.getStubSettings()).createStub();
+ }
+
+ @BetaApi("A restructuring of stub classes is planned, so this may break in the future")
+ protected EntityTypesClient(EntityTypesStub stub) {
+ this.settings = null;
+ this.stub = stub;
+ }
+
+ public final EntityTypesSettings getSettings() {
+ return settings;
+ }
+
+ @BetaApi("A restructuring of stub classes is planned, so this may break in the future")
+ public EntityTypesStub getStub() {
+ return stub;
+ }
+
+ // AUTO-GENERATED DOCUMENTATION AND METHOD
+ /**
+ * Returns the list of all entity types in the specified agent.
+ *
+ *
+ * EntityTypesSettings entityTypesSettings =
+ * EntityTypesSettings.newBuilder().setEndpoint(myEndpoint).build();
+ * EntityTypesClient entityTypesClient =
+ * EntityTypesClient.create(entityTypesSettings);
+ *
+ *
+ *
+ * @param parent Required. The agent to list all entity types for. Format: `projects/<Project
+ * ID>/locations/<Location ID>/agents/<Agent ID>`.
+ * @throws com.google.api.gax.rpc.ApiException if the remote call fails
+ */
+ public final ListEntityTypesPagedResponse listEntityTypes(AgentName parent) {
+ ListEntityTypesRequest request =
+ ListEntityTypesRequest.newBuilder()
+ .setParent(parent == null ? null : parent.toString())
+ .build();
+ return listEntityTypes(request);
+ }
+
+ // AUTO-GENERATED DOCUMENTATION AND METHOD
+ /**
+ * Returns the list of all entity types in the specified agent.
+ *
+ *
+ * try (EntityTypesClient entityTypesClient = EntityTypesClient.create()) {
+ * AgentName parent = AgentName.of("[PROJECT]", "[LOCATION]", "[AGENT]");
+ * for (EntityType element : entityTypesClient.listEntityTypes(parent).iterateAll()) {
+ * // doThingsWith(element);
+ * }
+ * }
+ *
+ *
+ * @param parent Required. The agent to list all entity types for. Format: `projects/<Project
+ * ID>/locations/<Location ID>/agents/<Agent ID>`.
+ * @throws com.google.api.gax.rpc.ApiException if the remote call fails
+ */
+ public final ListEntityTypesPagedResponse listEntityTypes(String parent) {
+ ListEntityTypesRequest request = ListEntityTypesRequest.newBuilder().setParent(parent).build();
+ return listEntityTypes(request);
+ }
+
+ // AUTO-GENERATED DOCUMENTATION AND METHOD
+ /**
+ * Returns the list of all entity types in the specified agent.
+ *
+ *
+ * try (EntityTypesClient entityTypesClient = EntityTypesClient.create()) {
+ * AgentName parent = AgentName.of("[PROJECT]", "[LOCATION]", "[AGENT]");
+ * for (EntityType element : entityTypesClient.listEntityTypes(parent.toString()).iterateAll()) {
+ * // doThingsWith(element);
+ * }
+ * }
+ *
+ *
+ * @param 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
+ */
+ public final ListEntityTypesPagedResponse listEntityTypes(ListEntityTypesRequest request) {
+ return listEntityTypesPagedCallable().call(request);
+ }
+
+ // AUTO-GENERATED DOCUMENTATION AND METHOD
+ /**
+ * Returns the list of all entity types in the specified agent.
+ *
+ *
+ * try (EntityTypesClient entityTypesClient = EntityTypesClient.create()) {
+ * AgentName parent = AgentName.of("[PROJECT]", "[LOCATION]", "[AGENT]");
+ * ListEntityTypesRequest request = ListEntityTypesRequest.newBuilder()
+ * .setParent(parent.toString())
+ * .build();
+ * for (EntityType element : entityTypesClient.listEntityTypes(request).iterateAll()) {
+ * // doThingsWith(element);
+ * }
+ * }
+ *
+ */
+ public final UnaryCallable
+ * try (EntityTypesClient entityTypesClient = EntityTypesClient.create()) {
+ * AgentName parent = AgentName.of("[PROJECT]", "[LOCATION]", "[AGENT]");
+ * ListEntityTypesRequest request = ListEntityTypesRequest.newBuilder()
+ * .setParent(parent.toString())
+ * .build();
+ * ApiFuture<ListEntityTypesPagedResponse> future = entityTypesClient.listEntityTypesPagedCallable().futureCall(request);
+ * // Do something
+ * for (EntityType element : future.get().iterateAll()) {
+ * // doThingsWith(element);
+ * }
+ * }
+ *
+ */
+ public final UnaryCallable
+ * try (EntityTypesClient entityTypesClient = EntityTypesClient.create()) {
+ * AgentName parent = AgentName.of("[PROJECT]", "[LOCATION]", "[AGENT]");
+ * ListEntityTypesRequest request = ListEntityTypesRequest.newBuilder()
+ * .setParent(parent.toString())
+ * .build();
+ * while (true) {
+ * ListEntityTypesResponse response = entityTypesClient.listEntityTypesCallable().call(request);
+ * for (EntityType element : response.getEntityTypesList()) {
+ * // doThingsWith(element);
+ * }
+ * String nextPageToken = response.getNextPageToken();
+ * if (!Strings.isNullOrEmpty(nextPageToken)) {
+ * request = request.toBuilder().setPageToken(nextPageToken).build();
+ * } else {
+ * break;
+ * }
+ * }
+ * }
+ *
+ *
+ * @param name Required. The name of the entity type. Format: `projects/<Project
+ * ID>/locations/<Location ID>/agents/<Agent ID>/entityTypes/<Entity Type
+ * ID>`.
+ * @throws com.google.api.gax.rpc.ApiException if the remote call fails
+ */
+ public final EntityType getEntityType(EntityTypeName name) {
+ GetEntityTypeRequest request =
+ GetEntityTypeRequest.newBuilder().setName(name == null ? null : name.toString()).build();
+ return getEntityType(request);
+ }
+
+ // AUTO-GENERATED DOCUMENTATION AND METHOD
+ /**
+ * Retrieves the specified entity type.
+ *
+ *
+ * try (EntityTypesClient entityTypesClient = EntityTypesClient.create()) {
+ * EntityTypeName name = EntityTypeName.of("[PROJECT]", "[LOCATION]", "[AGENT]", "[ENTITY_TYPE]");
+ * EntityType response = entityTypesClient.getEntityType(name);
+ * }
+ *
+ *
+ * @param name Required. The name of the entity type. Format: `projects/<Project
+ * ID>/locations/<Location ID>/agents/<Agent ID>/entityTypes/<Entity Type
+ * ID>`.
+ * @throws com.google.api.gax.rpc.ApiException if the remote call fails
+ */
+ public final EntityType getEntityType(String name) {
+ GetEntityTypeRequest request = GetEntityTypeRequest.newBuilder().setName(name).build();
+ return getEntityType(request);
+ }
+
+ // AUTO-GENERATED DOCUMENTATION AND METHOD
+ /**
+ * Retrieves the specified entity type.
+ *
+ *
+ * try (EntityTypesClient entityTypesClient = EntityTypesClient.create()) {
+ * EntityTypeName name = EntityTypeName.of("[PROJECT]", "[LOCATION]", "[AGENT]", "[ENTITY_TYPE]");
+ * EntityType response = entityTypesClient.getEntityType(name.toString());
+ * }
+ *
+ *
+ * @param 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
+ */
+ public final EntityType getEntityType(GetEntityTypeRequest request) {
+ return getEntityTypeCallable().call(request);
+ }
+
+ // AUTO-GENERATED DOCUMENTATION AND METHOD
+ /**
+ * Retrieves the specified entity type.
+ *
+ *
+ * try (EntityTypesClient entityTypesClient = EntityTypesClient.create()) {
+ * EntityTypeName name = EntityTypeName.of("[PROJECT]", "[LOCATION]", "[AGENT]", "[ENTITY_TYPE]");
+ * GetEntityTypeRequest request = GetEntityTypeRequest.newBuilder()
+ * .setName(name.toString())
+ * .build();
+ * EntityType response = entityTypesClient.getEntityType(request);
+ * }
+ *
+ */
+ public final UnaryCallable
+ * try (EntityTypesClient entityTypesClient = EntityTypesClient.create()) {
+ * EntityTypeName name = EntityTypeName.of("[PROJECT]", "[LOCATION]", "[AGENT]", "[ENTITY_TYPE]");
+ * GetEntityTypeRequest request = GetEntityTypeRequest.newBuilder()
+ * .setName(name.toString())
+ * .build();
+ * ApiFuture<EntityType> future = entityTypesClient.getEntityTypeCallable().futureCall(request);
+ * // Do something
+ * EntityType response = future.get();
+ * }
+ *
+ *
+ * @param parent Required. The agent to create a entity type for. Format: `projects/<Project
+ * ID>/locations/<Location ID>/agents/<Agent ID>`.
+ * @param entityType Required. The entity type to create.
+ * @throws com.google.api.gax.rpc.ApiException if the remote call fails
+ */
+ public final EntityType createEntityType(AgentName parent, EntityType entityType) {
+ CreateEntityTypeRequest request =
+ CreateEntityTypeRequest.newBuilder()
+ .setParent(parent == null ? null : parent.toString())
+ .setEntityType(entityType)
+ .build();
+ return createEntityType(request);
+ }
+
+ // AUTO-GENERATED DOCUMENTATION AND METHOD
+ /**
+ * Creates an entity type in the specified agent.
+ *
+ *
+ * try (EntityTypesClient entityTypesClient = EntityTypesClient.create()) {
+ * AgentName parent = AgentName.of("[PROJECT]", "[LOCATION]", "[AGENT]");
+ * EntityType entityType = EntityType.newBuilder().build();
+ * EntityType response = entityTypesClient.createEntityType(parent, entityType);
+ * }
+ *
+ *
+ * @param parent Required. The agent to create a entity type for. Format: `projects/<Project
+ * ID>/locations/<Location ID>/agents/<Agent ID>`.
+ * @param entityType Required. The entity type to create.
+ * @throws com.google.api.gax.rpc.ApiException if the remote call fails
+ */
+ public final EntityType createEntityType(String parent, EntityType entityType) {
+ CreateEntityTypeRequest request =
+ CreateEntityTypeRequest.newBuilder().setParent(parent).setEntityType(entityType).build();
+ return createEntityType(request);
+ }
+
+ // AUTO-GENERATED DOCUMENTATION AND METHOD
+ /**
+ * Creates an entity type in the specified agent.
+ *
+ *
+ * try (EntityTypesClient entityTypesClient = EntityTypesClient.create()) {
+ * AgentName parent = AgentName.of("[PROJECT]", "[LOCATION]", "[AGENT]");
+ * EntityType entityType = EntityType.newBuilder().build();
+ * EntityType response = entityTypesClient.createEntityType(parent.toString(), entityType);
+ * }
+ *
+ *
+ * @param 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
+ */
+ public final EntityType createEntityType(CreateEntityTypeRequest request) {
+ return createEntityTypeCallable().call(request);
+ }
+
+ // AUTO-GENERATED DOCUMENTATION AND METHOD
+ /**
+ * Creates an entity type in the specified agent.
+ *
+ *
+ * try (EntityTypesClient entityTypesClient = EntityTypesClient.create()) {
+ * AgentName parent = AgentName.of("[PROJECT]", "[LOCATION]", "[AGENT]");
+ * EntityType entityType = EntityType.newBuilder().build();
+ * CreateEntityTypeRequest request = CreateEntityTypeRequest.newBuilder()
+ * .setParent(parent.toString())
+ * .setEntityType(entityType)
+ * .build();
+ * EntityType response = entityTypesClient.createEntityType(request);
+ * }
+ *
+ */
+ public final UnaryCallable
+ * try (EntityTypesClient entityTypesClient = EntityTypesClient.create()) {
+ * AgentName parent = AgentName.of("[PROJECT]", "[LOCATION]", "[AGENT]");
+ * EntityType entityType = EntityType.newBuilder().build();
+ * CreateEntityTypeRequest request = CreateEntityTypeRequest.newBuilder()
+ * .setParent(parent.toString())
+ * .setEntityType(entityType)
+ * .build();
+ * ApiFuture<EntityType> future = entityTypesClient.createEntityTypeCallable().futureCall(request);
+ * // Do something
+ * EntityType response = future.get();
+ * }
+ *
+ *
+ * @param entityType Required. The entity type to update.
+ * @param updateMask The mask to control which fields get updated.
+ * @throws com.google.api.gax.rpc.ApiException if the remote call fails
+ */
+ public final EntityType updateEntityType(EntityType entityType, FieldMask updateMask) {
+ UpdateEntityTypeRequest request =
+ UpdateEntityTypeRequest.newBuilder()
+ .setEntityType(entityType)
+ .setUpdateMask(updateMask)
+ .build();
+ return updateEntityType(request);
+ }
+
+ // AUTO-GENERATED DOCUMENTATION AND METHOD
+ /**
+ * Updates the specified entity type.
+ *
+ *
+ * try (EntityTypesClient entityTypesClient = EntityTypesClient.create()) {
+ * EntityType entityType = EntityType.newBuilder().build();
+ * FieldMask updateMask = FieldMask.newBuilder().build();
+ * EntityType response = entityTypesClient.updateEntityType(entityType, updateMask);
+ * }
+ *
+ *
+ * @param 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
+ */
+ public final EntityType updateEntityType(UpdateEntityTypeRequest request) {
+ return updateEntityTypeCallable().call(request);
+ }
+
+ // AUTO-GENERATED DOCUMENTATION AND METHOD
+ /**
+ * Updates the specified entity type.
+ *
+ *
+ * try (EntityTypesClient entityTypesClient = EntityTypesClient.create()) {
+ * EntityType entityType = EntityType.newBuilder().build();
+ * UpdateEntityTypeRequest request = UpdateEntityTypeRequest.newBuilder()
+ * .setEntityType(entityType)
+ * .build();
+ * EntityType response = entityTypesClient.updateEntityType(request);
+ * }
+ *
+ */
+ public final UnaryCallable
+ * try (EntityTypesClient entityTypesClient = EntityTypesClient.create()) {
+ * EntityType entityType = EntityType.newBuilder().build();
+ * UpdateEntityTypeRequest request = UpdateEntityTypeRequest.newBuilder()
+ * .setEntityType(entityType)
+ * .build();
+ * ApiFuture<EntityType> future = entityTypesClient.updateEntityTypeCallable().futureCall(request);
+ * // Do something
+ * EntityType response = future.get();
+ * }
+ *
+ *
+ * @param name Required. The name of the entity type to delete. Format: `projects/<Project
+ * ID>/locations/<Location ID>/agents/<Agent ID>/entityTypes/<Entity Type
+ * ID>`.
+ * @throws com.google.api.gax.rpc.ApiException if the remote call fails
+ */
+ public final void deleteEntityType(EntityTypeName name) {
+ DeleteEntityTypeRequest request =
+ DeleteEntityTypeRequest.newBuilder().setName(name == null ? null : name.toString()).build();
+ deleteEntityType(request);
+ }
+
+ // AUTO-GENERATED DOCUMENTATION AND METHOD
+ /**
+ * Deletes the specified entity type.
+ *
+ *
+ * try (EntityTypesClient entityTypesClient = EntityTypesClient.create()) {
+ * EntityTypeName name = EntityTypeName.of("[PROJECT]", "[LOCATION]", "[AGENT]", "[ENTITY_TYPE]");
+ * entityTypesClient.deleteEntityType(name);
+ * }
+ *
+ *
+ * @param name Required. The name of the entity type to delete. Format: `projects/<Project
+ * ID>/locations/<Location ID>/agents/<Agent ID>/entityTypes/<Entity Type
+ * ID>`.
+ * @throws com.google.api.gax.rpc.ApiException if the remote call fails
+ */
+ public final void deleteEntityType(String name) {
+ DeleteEntityTypeRequest request = DeleteEntityTypeRequest.newBuilder().setName(name).build();
+ deleteEntityType(request);
+ }
+
+ // AUTO-GENERATED DOCUMENTATION AND METHOD
+ /**
+ * Deletes the specified entity type.
+ *
+ *
+ * try (EntityTypesClient entityTypesClient = EntityTypesClient.create()) {
+ * EntityTypeName name = EntityTypeName.of("[PROJECT]", "[LOCATION]", "[AGENT]", "[ENTITY_TYPE]");
+ * entityTypesClient.deleteEntityType(name.toString());
+ * }
+ *
+ *
+ * @param 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
+ */
+ public final void deleteEntityType(DeleteEntityTypeRequest request) {
+ deleteEntityTypeCallable().call(request);
+ }
+
+ // AUTO-GENERATED DOCUMENTATION AND METHOD
+ /**
+ * Deletes the specified entity type.
+ *
+ *
+ * try (EntityTypesClient entityTypesClient = EntityTypesClient.create()) {
+ * EntityTypeName name = EntityTypeName.of("[PROJECT]", "[LOCATION]", "[AGENT]", "[ENTITY_TYPE]");
+ * DeleteEntityTypeRequest request = DeleteEntityTypeRequest.newBuilder()
+ * .setName(name.toString())
+ * .build();
+ * entityTypesClient.deleteEntityType(request);
+ * }
+ *
+ */
+ public final UnaryCallable
+ * try (EntityTypesClient entityTypesClient = EntityTypesClient.create()) {
+ * EntityTypeName name = EntityTypeName.of("[PROJECT]", "[LOCATION]", "[AGENT]", "[ENTITY_TYPE]");
+ * DeleteEntityTypeRequest request = DeleteEntityTypeRequest.newBuilder()
+ * .setName(name.toString())
+ * .build();
+ * ApiFuture<Void> future = entityTypesClient.deleteEntityTypeCallable().futureCall(request);
+ * // Do something
+ * future.get();
+ * }
+ *
+ *
+ *
+ *
+ *
+ */
+@Generated("by gapic-generator")
+public class EntityTypesSettings extends ClientSettings
+ * EntityTypesSettings.Builder entityTypesSettingsBuilder =
+ * EntityTypesSettings.newBuilder();
+ * entityTypesSettingsBuilder
+ * .getEntityTypeSettings()
+ * .setRetrySettings(
+ * entityTypesSettingsBuilder.getEntityTypeSettings().getRetrySettings().toBuilder()
+ * .setTotalTimeout(Duration.ofSeconds(30))
+ * .build());
+ * EntityTypesSettings entityTypesSettings = entityTypesSettingsBuilder.build();
+ *
+ *
+ *
+ *
+ *
+ * try (EnvironmentsClient environmentsClient = EnvironmentsClient.create()) {
+ * EnvironmentName name = EnvironmentName.of("[PROJECT]", "[LOCATION]", "[AGENT]", "[ENVIRONMENT]");
+ * Environment response = environmentsClient.getEnvironment(name);
+ * }
+ *
+ *
+ *
+ *
+ *
+ *
+ *
+ * To customize the endpoint:
+ *
+ *
+ * EnvironmentsSettings environmentsSettings =
+ * EnvironmentsSettings.newBuilder()
+ * .setCredentialsProvider(FixedCredentialsProvider.create(myCredentials))
+ * .build();
+ * EnvironmentsClient environmentsClient =
+ * EnvironmentsClient.create(environmentsSettings);
+ *
+ *
+ *
+ */
+@Generated("by gapic-generator")
+public class EnvironmentsClient implements BackgroundResource {
+ private final EnvironmentsSettings settings;
+ private final EnvironmentsStub stub;
+ private final OperationsClient operationsClient;
+
+ /** Constructs an instance of EnvironmentsClient with default settings. */
+ public static final EnvironmentsClient create() throws IOException {
+ return create(EnvironmentsSettings.newBuilder().build());
+ }
+
+ /**
+ * Constructs an instance of EnvironmentsClient, using the given settings. The channels are
+ * created based on the settings passed in, or defaults for any settings that are not set.
+ */
+ public static final EnvironmentsClient create(EnvironmentsSettings settings) throws IOException {
+ return new EnvironmentsClient(settings);
+ }
+
+ /**
+ * Constructs an instance of EnvironmentsClient, using the given stub for making calls. This is
+ * for advanced usage - prefer to use EnvironmentsSettings}.
+ */
+ @BetaApi("A restructuring of stub classes is planned, so this may break in the future")
+ public static final EnvironmentsClient create(EnvironmentsStub stub) {
+ return new EnvironmentsClient(stub);
+ }
+
+ /**
+ * Constructs an instance of EnvironmentsClient, 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.
+ */
+ protected EnvironmentsClient(EnvironmentsSettings settings) throws IOException {
+ this.settings = settings;
+ this.stub = ((EnvironmentsStubSettings) settings.getStubSettings()).createStub();
+ this.operationsClient = OperationsClient.create(this.stub.getOperationsStub());
+ }
+
+ @BetaApi("A restructuring of stub classes is planned, so this may break in the future")
+ protected EnvironmentsClient(EnvironmentsStub stub) {
+ this.settings = null;
+ this.stub = stub;
+ this.operationsClient = OperationsClient.create(this.stub.getOperationsStub());
+ }
+
+ public final EnvironmentsSettings getSettings() {
+ return settings;
+ }
+
+ @BetaApi("A restructuring of stub classes is planned, so this may break in the future")
+ public EnvironmentsStub getStub() {
+ return stub;
+ }
+
+ /**
+ * Returns the OperationsClient that can be used to query the status of a long-running operation
+ * returned by another API method call.
+ */
+ @BetaApi(
+ "The surface for long-running operations is not stable yet and may change in the future.")
+ public final OperationsClient getOperationsClient() {
+ return operationsClient;
+ }
+
+ // AUTO-GENERATED DOCUMENTATION AND METHOD
+ /**
+ * Returns the list of all environments in the specified
+ * [Agent][google.cloud.dialogflow.cx.v3.Agent].
+ *
+ *
+ * EnvironmentsSettings environmentsSettings =
+ * EnvironmentsSettings.newBuilder().setEndpoint(myEndpoint).build();
+ * EnvironmentsClient environmentsClient =
+ * EnvironmentsClient.create(environmentsSettings);
+ *
+ *
+ *
+ * @param parent Required. The [Agent][google.cloud.dialogflow.cx.v3.Agent] to list all
+ * environments for. Format: `projects/<Project ID>/locations/<Location
+ * ID>/agents/<Agent ID>`.
+ * @throws com.google.api.gax.rpc.ApiException if the remote call fails
+ */
+ public final ListEnvironmentsPagedResponse listEnvironments(AgentName parent) {
+ ListEnvironmentsRequest request =
+ ListEnvironmentsRequest.newBuilder()
+ .setParent(parent == null ? null : parent.toString())
+ .build();
+ return listEnvironments(request);
+ }
+
+ // AUTO-GENERATED DOCUMENTATION AND METHOD
+ /**
+ * Returns the list of all environments in the specified
+ * [Agent][google.cloud.dialogflow.cx.v3.Agent].
+ *
+ *
+ * try (EnvironmentsClient environmentsClient = EnvironmentsClient.create()) {
+ * AgentName parent = AgentName.of("[PROJECT]", "[LOCATION]", "[AGENT]");
+ * for (Environment element : environmentsClient.listEnvironments(parent).iterateAll()) {
+ * // doThingsWith(element);
+ * }
+ * }
+ *
+ *
+ * @param parent Required. The [Agent][google.cloud.dialogflow.cx.v3.Agent] to list all
+ * environments for. Format: `projects/<Project ID>/locations/<Location
+ * ID>/agents/<Agent ID>`.
+ * @throws com.google.api.gax.rpc.ApiException if the remote call fails
+ */
+ public final ListEnvironmentsPagedResponse listEnvironments(String parent) {
+ ListEnvironmentsRequest request =
+ ListEnvironmentsRequest.newBuilder().setParent(parent).build();
+ return listEnvironments(request);
+ }
+
+ // AUTO-GENERATED DOCUMENTATION AND METHOD
+ /**
+ * Returns the list of all environments in the specified
+ * [Agent][google.cloud.dialogflow.cx.v3.Agent].
+ *
+ *
+ * try (EnvironmentsClient environmentsClient = EnvironmentsClient.create()) {
+ * AgentName parent = AgentName.of("[PROJECT]", "[LOCATION]", "[AGENT]");
+ * for (Environment element : environmentsClient.listEnvironments(parent.toString()).iterateAll()) {
+ * // doThingsWith(element);
+ * }
+ * }
+ *
+ *
+ * @param 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
+ */
+ public final ListEnvironmentsPagedResponse listEnvironments(ListEnvironmentsRequest request) {
+ return listEnvironmentsPagedCallable().call(request);
+ }
+
+ // AUTO-GENERATED DOCUMENTATION AND METHOD
+ /**
+ * Returns the list of all environments in the specified
+ * [Agent][google.cloud.dialogflow.cx.v3.Agent].
+ *
+ *
+ * try (EnvironmentsClient environmentsClient = EnvironmentsClient.create()) {
+ * AgentName parent = AgentName.of("[PROJECT]", "[LOCATION]", "[AGENT]");
+ * ListEnvironmentsRequest request = ListEnvironmentsRequest.newBuilder()
+ * .setParent(parent.toString())
+ * .build();
+ * for (Environment element : environmentsClient.listEnvironments(request).iterateAll()) {
+ * // doThingsWith(element);
+ * }
+ * }
+ *
+ */
+ public final UnaryCallable
+ * try (EnvironmentsClient environmentsClient = EnvironmentsClient.create()) {
+ * AgentName parent = AgentName.of("[PROJECT]", "[LOCATION]", "[AGENT]");
+ * ListEnvironmentsRequest request = ListEnvironmentsRequest.newBuilder()
+ * .setParent(parent.toString())
+ * .build();
+ * ApiFuture<ListEnvironmentsPagedResponse> future = environmentsClient.listEnvironmentsPagedCallable().futureCall(request);
+ * // Do something
+ * for (Environment element : future.get().iterateAll()) {
+ * // doThingsWith(element);
+ * }
+ * }
+ *
+ */
+ public final UnaryCallable
+ * try (EnvironmentsClient environmentsClient = EnvironmentsClient.create()) {
+ * AgentName parent = AgentName.of("[PROJECT]", "[LOCATION]", "[AGENT]");
+ * ListEnvironmentsRequest request = ListEnvironmentsRequest.newBuilder()
+ * .setParent(parent.toString())
+ * .build();
+ * while (true) {
+ * ListEnvironmentsResponse response = environmentsClient.listEnvironmentsCallable().call(request);
+ * for (Environment element : response.getEnvironmentsList()) {
+ * // doThingsWith(element);
+ * }
+ * String nextPageToken = response.getNextPageToken();
+ * if (!Strings.isNullOrEmpty(nextPageToken)) {
+ * request = request.toBuilder().setPageToken(nextPageToken).build();
+ * } else {
+ * break;
+ * }
+ * }
+ * }
+ *
+ *
+ * @param 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>`.
+ * @throws com.google.api.gax.rpc.ApiException if the remote call fails
+ */
+ public final Environment getEnvironment(EnvironmentName name) {
+ GetEnvironmentRequest request =
+ GetEnvironmentRequest.newBuilder().setName(name == null ? null : name.toString()).build();
+ return getEnvironment(request);
+ }
+
+ // AUTO-GENERATED DOCUMENTATION AND METHOD
+ /**
+ * Retrieves the specified [Environment][google.cloud.dialogflow.cx.v3.Environment].
+ *
+ *
+ * try (EnvironmentsClient environmentsClient = EnvironmentsClient.create()) {
+ * EnvironmentName name = EnvironmentName.of("[PROJECT]", "[LOCATION]", "[AGENT]", "[ENVIRONMENT]");
+ * Environment response = environmentsClient.getEnvironment(name);
+ * }
+ *
+ *
+ * @param 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>`.
+ * @throws com.google.api.gax.rpc.ApiException if the remote call fails
+ */
+ public final Environment getEnvironment(String name) {
+ GetEnvironmentRequest request = GetEnvironmentRequest.newBuilder().setName(name).build();
+ return getEnvironment(request);
+ }
+
+ // AUTO-GENERATED DOCUMENTATION AND METHOD
+ /**
+ * Retrieves the specified [Environment][google.cloud.dialogflow.cx.v3.Environment].
+ *
+ *
+ * try (EnvironmentsClient environmentsClient = EnvironmentsClient.create()) {
+ * EnvironmentName name = EnvironmentName.of("[PROJECT]", "[LOCATION]", "[AGENT]", "[ENVIRONMENT]");
+ * Environment response = environmentsClient.getEnvironment(name.toString());
+ * }
+ *
+ *
+ * @param 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
+ */
+ public final Environment getEnvironment(GetEnvironmentRequest request) {
+ return getEnvironmentCallable().call(request);
+ }
+
+ // AUTO-GENERATED DOCUMENTATION AND METHOD
+ /**
+ * Retrieves the specified [Environment][google.cloud.dialogflow.cx.v3.Environment].
+ *
+ *
+ * try (EnvironmentsClient environmentsClient = EnvironmentsClient.create()) {
+ * EnvironmentName name = EnvironmentName.of("[PROJECT]", "[LOCATION]", "[AGENT]", "[ENVIRONMENT]");
+ * GetEnvironmentRequest request = GetEnvironmentRequest.newBuilder()
+ * .setName(name.toString())
+ * .build();
+ * Environment response = environmentsClient.getEnvironment(request);
+ * }
+ *
+ */
+ public final UnaryCallable
+ * try (EnvironmentsClient environmentsClient = EnvironmentsClient.create()) {
+ * EnvironmentName name = EnvironmentName.of("[PROJECT]", "[LOCATION]", "[AGENT]", "[ENVIRONMENT]");
+ * GetEnvironmentRequest request = GetEnvironmentRequest.newBuilder()
+ * .setName(name.toString())
+ * .build();
+ * ApiFuture<Environment> future = environmentsClient.getEnvironmentCallable().futureCall(request);
+ * // Do something
+ * Environment response = future.get();
+ * }
+ *
+ *
+ * @param 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>`.
+ * @param environment Required. The environment to create.
+ * @throws com.google.api.gax.rpc.ApiException if the remote call fails
+ */
+ @BetaApi(
+ "The surface for long-running operations is not stable yet and may change in the future.")
+ public final OperationFuture
+ * try (EnvironmentsClient environmentsClient = EnvironmentsClient.create()) {
+ * AgentName parent = AgentName.of("[PROJECT]", "[LOCATION]", "[AGENT]");
+ * Environment environment = Environment.newBuilder().build();
+ * Environment response = environmentsClient.createEnvironmentAsync(parent, environment).get();
+ * }
+ *
+ *
+ * @param 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>`.
+ * @param environment Required. The environment to create.
+ * @throws com.google.api.gax.rpc.ApiException if the remote call fails
+ */
+ @BetaApi(
+ "The surface for long-running operations is not stable yet and may change in the future.")
+ public final OperationFuture
+ * try (EnvironmentsClient environmentsClient = EnvironmentsClient.create()) {
+ * AgentName parent = AgentName.of("[PROJECT]", "[LOCATION]", "[AGENT]");
+ * Environment environment = Environment.newBuilder().build();
+ * Environment response = environmentsClient.createEnvironmentAsync(parent.toString(), environment).get();
+ * }
+ *
+ *
+ * @param 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
+ */
+ @BetaApi(
+ "The surface for long-running operations is not stable yet and may change in the future.")
+ public final OperationFuture
+ * try (EnvironmentsClient environmentsClient = EnvironmentsClient.create()) {
+ * AgentName parent = AgentName.of("[PROJECT]", "[LOCATION]", "[AGENT]");
+ * Environment environment = Environment.newBuilder().build();
+ * CreateEnvironmentRequest request = CreateEnvironmentRequest.newBuilder()
+ * .setParent(parent.toString())
+ * .setEnvironment(environment)
+ * .build();
+ * Environment response = environmentsClient.createEnvironmentAsync(request).get();
+ * }
+ *
+ */
+ @BetaApi("The surface for use by generated code is not stable yet and may change in the future.")
+ public final OperationCallable
+ * try (EnvironmentsClient environmentsClient = EnvironmentsClient.create()) {
+ * AgentName parent = AgentName.of("[PROJECT]", "[LOCATION]", "[AGENT]");
+ * Environment environment = Environment.newBuilder().build();
+ * CreateEnvironmentRequest request = CreateEnvironmentRequest.newBuilder()
+ * .setParent(parent.toString())
+ * .setEnvironment(environment)
+ * .build();
+ * OperationFuture<Environment, Struct> future = environmentsClient.createEnvironmentOperationCallable().futureCall(request);
+ * // Do something
+ * Environment response = future.get();
+ * }
+ *
+ */
+ public final UnaryCallable
+ * try (EnvironmentsClient environmentsClient = EnvironmentsClient.create()) {
+ * AgentName parent = AgentName.of("[PROJECT]", "[LOCATION]", "[AGENT]");
+ * Environment environment = Environment.newBuilder().build();
+ * CreateEnvironmentRequest request = CreateEnvironmentRequest.newBuilder()
+ * .setParent(parent.toString())
+ * .setEnvironment(environment)
+ * .build();
+ * ApiFuture<Operation> future = environmentsClient.createEnvironmentCallable().futureCall(request);
+ * // Do something
+ * Operation response = future.get();
+ * }
+ *
+ *
+ * @param environment Required. The environment to update.
+ * @param updateMask Required. The mask to control which fields get updated.
+ * @throws com.google.api.gax.rpc.ApiException if the remote call fails
+ */
+ @BetaApi(
+ "The surface for long-running operations is not stable yet and may change in the future.")
+ public final OperationFuture
+ * try (EnvironmentsClient environmentsClient = EnvironmentsClient.create()) {
+ * Environment environment = Environment.newBuilder().build();
+ * FieldMask updateMask = FieldMask.newBuilder().build();
+ * Environment response = environmentsClient.updateEnvironmentAsync(environment, updateMask).get();
+ * }
+ *
+ *
+ * @param 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
+ */
+ @BetaApi(
+ "The surface for long-running operations is not stable yet and may change in the future.")
+ public final OperationFuture
+ * try (EnvironmentsClient environmentsClient = EnvironmentsClient.create()) {
+ * Environment environment = Environment.newBuilder().build();
+ * FieldMask updateMask = FieldMask.newBuilder().build();
+ * UpdateEnvironmentRequest request = UpdateEnvironmentRequest.newBuilder()
+ * .setEnvironment(environment)
+ * .setUpdateMask(updateMask)
+ * .build();
+ * Environment response = environmentsClient.updateEnvironmentAsync(request).get();
+ * }
+ *
+ */
+ @BetaApi("The surface for use by generated code is not stable yet and may change in the future.")
+ public final OperationCallable
+ * try (EnvironmentsClient environmentsClient = EnvironmentsClient.create()) {
+ * Environment environment = Environment.newBuilder().build();
+ * FieldMask updateMask = FieldMask.newBuilder().build();
+ * UpdateEnvironmentRequest request = UpdateEnvironmentRequest.newBuilder()
+ * .setEnvironment(environment)
+ * .setUpdateMask(updateMask)
+ * .build();
+ * OperationFuture<Environment, Struct> future = environmentsClient.updateEnvironmentOperationCallable().futureCall(request);
+ * // Do something
+ * Environment response = future.get();
+ * }
+ *
+ */
+ public final UnaryCallable
+ * try (EnvironmentsClient environmentsClient = EnvironmentsClient.create()) {
+ * Environment environment = Environment.newBuilder().build();
+ * FieldMask updateMask = FieldMask.newBuilder().build();
+ * UpdateEnvironmentRequest request = UpdateEnvironmentRequest.newBuilder()
+ * .setEnvironment(environment)
+ * .setUpdateMask(updateMask)
+ * .build();
+ * ApiFuture<Operation> future = environmentsClient.updateEnvironmentCallable().futureCall(request);
+ * // Do something
+ * Operation response = future.get();
+ * }
+ *
+ *
+ * @param 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>`.
+ * @throws com.google.api.gax.rpc.ApiException if the remote call fails
+ */
+ public final void deleteEnvironment(EnvironmentName name) {
+ DeleteEnvironmentRequest request =
+ DeleteEnvironmentRequest.newBuilder()
+ .setName(name == null ? null : name.toString())
+ .build();
+ deleteEnvironment(request);
+ }
+
+ // AUTO-GENERATED DOCUMENTATION AND METHOD
+ /**
+ * Deletes the specified [Environment][google.cloud.dialogflow.cx.v3.Environment].
+ *
+ *
+ * try (EnvironmentsClient environmentsClient = EnvironmentsClient.create()) {
+ * EnvironmentName name = EnvironmentName.of("[PROJECT]", "[LOCATION]", "[AGENT]", "[ENVIRONMENT]");
+ * environmentsClient.deleteEnvironment(name);
+ * }
+ *
+ *
+ * @param 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>`.
+ * @throws com.google.api.gax.rpc.ApiException if the remote call fails
+ */
+ public final void deleteEnvironment(String name) {
+ DeleteEnvironmentRequest request = DeleteEnvironmentRequest.newBuilder().setName(name).build();
+ deleteEnvironment(request);
+ }
+
+ // AUTO-GENERATED DOCUMENTATION AND METHOD
+ /**
+ * Deletes the specified [Environment][google.cloud.dialogflow.cx.v3.Environment].
+ *
+ *
+ * try (EnvironmentsClient environmentsClient = EnvironmentsClient.create()) {
+ * EnvironmentName name = EnvironmentName.of("[PROJECT]", "[LOCATION]", "[AGENT]", "[ENVIRONMENT]");
+ * environmentsClient.deleteEnvironment(name.toString());
+ * }
+ *
+ *
+ * @param 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
+ */
+ public final void deleteEnvironment(DeleteEnvironmentRequest request) {
+ deleteEnvironmentCallable().call(request);
+ }
+
+ // AUTO-GENERATED DOCUMENTATION AND METHOD
+ /**
+ * Deletes the specified [Environment][google.cloud.dialogflow.cx.v3.Environment].
+ *
+ *
+ * try (EnvironmentsClient environmentsClient = EnvironmentsClient.create()) {
+ * EnvironmentName name = EnvironmentName.of("[PROJECT]", "[LOCATION]", "[AGENT]", "[ENVIRONMENT]");
+ * DeleteEnvironmentRequest request = DeleteEnvironmentRequest.newBuilder()
+ * .setName(name.toString())
+ * .build();
+ * environmentsClient.deleteEnvironment(request);
+ * }
+ *
+ */
+ public final UnaryCallable
+ * try (EnvironmentsClient environmentsClient = EnvironmentsClient.create()) {
+ * EnvironmentName name = EnvironmentName.of("[PROJECT]", "[LOCATION]", "[AGENT]", "[ENVIRONMENT]");
+ * DeleteEnvironmentRequest request = DeleteEnvironmentRequest.newBuilder()
+ * .setName(name.toString())
+ * .build();
+ * ApiFuture<Void> future = environmentsClient.deleteEnvironmentCallable().futureCall(request);
+ * // Do something
+ * future.get();
+ * }
+ *
+ *
+ * @param name Required. Resource name of the environment to look up the history 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
+ */
+ public final LookupEnvironmentHistoryPagedResponse lookupEnvironmentHistory(
+ EnvironmentName name) {
+ LookupEnvironmentHistoryRequest request =
+ LookupEnvironmentHistoryRequest.newBuilder()
+ .setName(name == null ? null : name.toString())
+ .build();
+ return lookupEnvironmentHistory(request);
+ }
+
+ // AUTO-GENERATED DOCUMENTATION AND METHOD
+ /**
+ * Looks up the history of the specified [Environment][google.cloud.dialogflow.cx.v3.Environment].
+ *
+ *
+ * try (EnvironmentsClient environmentsClient = EnvironmentsClient.create()) {
+ * EnvironmentName name = EnvironmentName.of("[PROJECT]", "[LOCATION]", "[AGENT]", "[ENVIRONMENT]");
+ * for (Environment element : environmentsClient.lookupEnvironmentHistory(name).iterateAll()) {
+ * // doThingsWith(element);
+ * }
+ * }
+ *
+ *
+ * @param name Required. Resource name of the environment to look up the history 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
+ */
+ public final LookupEnvironmentHistoryPagedResponse lookupEnvironmentHistory(String name) {
+ LookupEnvironmentHistoryRequest request =
+ LookupEnvironmentHistoryRequest.newBuilder().setName(name).build();
+ return lookupEnvironmentHistory(request);
+ }
+
+ // AUTO-GENERATED DOCUMENTATION AND METHOD
+ /**
+ * Looks up the history of the specified [Environment][google.cloud.dialogflow.cx.v3.Environment].
+ *
+ *
+ * try (EnvironmentsClient environmentsClient = EnvironmentsClient.create()) {
+ * EnvironmentName name = EnvironmentName.of("[PROJECT]", "[LOCATION]", "[AGENT]", "[ENVIRONMENT]");
+ * for (Environment element : environmentsClient.lookupEnvironmentHistory(name.toString()).iterateAll()) {
+ * // doThingsWith(element);
+ * }
+ * }
+ *
+ *
+ * @param 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
+ */
+ public final LookupEnvironmentHistoryPagedResponse lookupEnvironmentHistory(
+ LookupEnvironmentHistoryRequest request) {
+ return lookupEnvironmentHistoryPagedCallable().call(request);
+ }
+
+ // AUTO-GENERATED DOCUMENTATION AND METHOD
+ /**
+ * Looks up the history of the specified [Environment][google.cloud.dialogflow.cx.v3.Environment].
+ *
+ *
+ * try (EnvironmentsClient environmentsClient = EnvironmentsClient.create()) {
+ * EnvironmentName name = EnvironmentName.of("[PROJECT]", "[LOCATION]", "[AGENT]", "[ENVIRONMENT]");
+ * LookupEnvironmentHistoryRequest request = LookupEnvironmentHistoryRequest.newBuilder()
+ * .setName(name.toString())
+ * .build();
+ * for (Environment element : environmentsClient.lookupEnvironmentHistory(request).iterateAll()) {
+ * // doThingsWith(element);
+ * }
+ * }
+ *
+ */
+ public final UnaryCallable
+ * try (EnvironmentsClient environmentsClient = EnvironmentsClient.create()) {
+ * EnvironmentName name = EnvironmentName.of("[PROJECT]", "[LOCATION]", "[AGENT]", "[ENVIRONMENT]");
+ * LookupEnvironmentHistoryRequest request = LookupEnvironmentHistoryRequest.newBuilder()
+ * .setName(name.toString())
+ * .build();
+ * ApiFuture<LookupEnvironmentHistoryPagedResponse> future = environmentsClient.lookupEnvironmentHistoryPagedCallable().futureCall(request);
+ * // Do something
+ * for (Environment element : future.get().iterateAll()) {
+ * // doThingsWith(element);
+ * }
+ * }
+ *
+ */
+ public final UnaryCallable
+ * try (EnvironmentsClient environmentsClient = EnvironmentsClient.create()) {
+ * EnvironmentName name = EnvironmentName.of("[PROJECT]", "[LOCATION]", "[AGENT]", "[ENVIRONMENT]");
+ * LookupEnvironmentHistoryRequest request = LookupEnvironmentHistoryRequest.newBuilder()
+ * .setName(name.toString())
+ * .build();
+ * while (true) {
+ * LookupEnvironmentHistoryResponse response = environmentsClient.lookupEnvironmentHistoryCallable().call(request);
+ * for (Environment element : response.getEnvironmentsList()) {
+ * // doThingsWith(element);
+ * }
+ * String nextPageToken = response.getNextPageToken();
+ * if (!Strings.isNullOrEmpty(nextPageToken)) {
+ * request = request.toBuilder().setPageToken(nextPageToken).build();
+ * } else {
+ * break;
+ * }
+ * }
+ * }
+ *
+ *
+ *
+ *
+ *
+ */
+@Generated("by gapic-generator")
+public class EnvironmentsSettings extends ClientSettings
+ * EnvironmentsSettings.Builder environmentsSettingsBuilder =
+ * EnvironmentsSettings.newBuilder();
+ * environmentsSettingsBuilder
+ * .getEnvironmentSettings()
+ * .setRetrySettings(
+ * environmentsSettingsBuilder.getEnvironmentSettings().getRetrySettings().toBuilder()
+ * .setTotalTimeout(Duration.ofSeconds(30))
+ * .build());
+ * EnvironmentsSettings environmentsSettings = environmentsSettingsBuilder.build();
+ *
+ *
+ *
+ *
+ *
+ * try (FlowsClient flowsClient = FlowsClient.create()) {
+ * AgentName parent = AgentName.of("[PROJECT]", "[LOCATION]", "[AGENT]");
+ * Flow flow = Flow.newBuilder().build();
+ * Flow response = flowsClient.createFlow(parent, flow);
+ * }
+ *
+ *
+ *
+ *
+ *
+ *
+ *
+ * To customize the endpoint:
+ *
+ *
+ * FlowsSettings flowsSettings =
+ * FlowsSettings.newBuilder()
+ * .setCredentialsProvider(FixedCredentialsProvider.create(myCredentials))
+ * .build();
+ * FlowsClient flowsClient =
+ * FlowsClient.create(flowsSettings);
+ *
+ *
+ *
+ */
+@Generated("by gapic-generator")
+public class FlowsClient implements BackgroundResource {
+ private final FlowsSettings settings;
+ private final FlowsStub stub;
+ private final OperationsClient operationsClient;
+
+ /** Constructs an instance of FlowsClient with default settings. */
+ public static final FlowsClient create() throws IOException {
+ return create(FlowsSettings.newBuilder().build());
+ }
+
+ /**
+ * Constructs an instance of FlowsClient, using the given settings. The channels are created based
+ * on the settings passed in, or defaults for any settings that are not set.
+ */
+ public static final FlowsClient create(FlowsSettings settings) throws IOException {
+ return new FlowsClient(settings);
+ }
+
+ /**
+ * Constructs an instance of FlowsClient, using the given stub for making calls. This is for
+ * advanced usage - prefer to use FlowsSettings}.
+ */
+ @BetaApi("A restructuring of stub classes is planned, so this may break in the future")
+ public static final FlowsClient create(FlowsStub stub) {
+ return new FlowsClient(stub);
+ }
+
+ /**
+ * Constructs an instance of FlowsClient, 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.
+ */
+ protected FlowsClient(FlowsSettings settings) throws IOException {
+ this.settings = settings;
+ this.stub = ((FlowsStubSettings) settings.getStubSettings()).createStub();
+ this.operationsClient = OperationsClient.create(this.stub.getOperationsStub());
+ }
+
+ @BetaApi("A restructuring of stub classes is planned, so this may break in the future")
+ protected FlowsClient(FlowsStub stub) {
+ this.settings = null;
+ this.stub = stub;
+ this.operationsClient = OperationsClient.create(this.stub.getOperationsStub());
+ }
+
+ public final FlowsSettings getSettings() {
+ return settings;
+ }
+
+ @BetaApi("A restructuring of stub classes is planned, so this may break in the future")
+ public FlowsStub getStub() {
+ return stub;
+ }
+
+ /**
+ * Returns the OperationsClient that can be used to query the status of a long-running operation
+ * returned by another API method call.
+ */
+ @BetaApi(
+ "The surface for long-running operations is not stable yet and may change in the future.")
+ public final OperationsClient getOperationsClient() {
+ return operationsClient;
+ }
+
+ // AUTO-GENERATED DOCUMENTATION AND METHOD
+ /**
+ * Creates a flow in the specified agent.
+ *
+ *
+ * FlowsSettings flowsSettings =
+ * FlowsSettings.newBuilder().setEndpoint(myEndpoint).build();
+ * FlowsClient flowsClient =
+ * FlowsClient.create(flowsSettings);
+ *
+ *
+ *
+ * @param parent Required. The agent to create a flow for. Format: `projects/<Project
+ * ID>/locations/<Location ID>/agents/<Agent ID>`.
+ * @param flow Required. The flow to create.
+ * @throws com.google.api.gax.rpc.ApiException if the remote call fails
+ */
+ public final Flow createFlow(AgentName parent, Flow flow) {
+ CreateFlowRequest request =
+ CreateFlowRequest.newBuilder()
+ .setParent(parent == null ? null : parent.toString())
+ .setFlow(flow)
+ .build();
+ return createFlow(request);
+ }
+
+ // AUTO-GENERATED DOCUMENTATION AND METHOD
+ /**
+ * Creates a flow in the specified agent.
+ *
+ *
+ * try (FlowsClient flowsClient = FlowsClient.create()) {
+ * AgentName parent = AgentName.of("[PROJECT]", "[LOCATION]", "[AGENT]");
+ * Flow flow = Flow.newBuilder().build();
+ * Flow response = flowsClient.createFlow(parent, flow);
+ * }
+ *
+ *
+ * @param parent Required. The agent to create a flow for. Format: `projects/<Project
+ * ID>/locations/<Location ID>/agents/<Agent ID>`.
+ * @param flow Required. The flow to create.
+ * @throws com.google.api.gax.rpc.ApiException if the remote call fails
+ */
+ public final Flow createFlow(String parent, Flow flow) {
+ CreateFlowRequest request =
+ CreateFlowRequest.newBuilder().setParent(parent).setFlow(flow).build();
+ return createFlow(request);
+ }
+
+ // AUTO-GENERATED DOCUMENTATION AND METHOD
+ /**
+ * Creates a flow in the specified agent.
+ *
+ *
+ * try (FlowsClient flowsClient = FlowsClient.create()) {
+ * AgentName parent = AgentName.of("[PROJECT]", "[LOCATION]", "[AGENT]");
+ * Flow flow = Flow.newBuilder().build();
+ * Flow response = flowsClient.createFlow(parent.toString(), flow);
+ * }
+ *
+ *
+ * @param 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
+ */
+ public final Flow createFlow(CreateFlowRequest request) {
+ return createFlowCallable().call(request);
+ }
+
+ // AUTO-GENERATED DOCUMENTATION AND METHOD
+ /**
+ * Creates a flow in the specified agent.
+ *
+ *
+ * try (FlowsClient flowsClient = FlowsClient.create()) {
+ * AgentName parent = AgentName.of("[PROJECT]", "[LOCATION]", "[AGENT]");
+ * Flow flow = Flow.newBuilder().build();
+ * CreateFlowRequest request = CreateFlowRequest.newBuilder()
+ * .setParent(parent.toString())
+ * .setFlow(flow)
+ * .build();
+ * Flow response = flowsClient.createFlow(request);
+ * }
+ *
+ */
+ public final UnaryCallable
+ * try (FlowsClient flowsClient = FlowsClient.create()) {
+ * AgentName parent = AgentName.of("[PROJECT]", "[LOCATION]", "[AGENT]");
+ * Flow flow = Flow.newBuilder().build();
+ * CreateFlowRequest request = CreateFlowRequest.newBuilder()
+ * .setParent(parent.toString())
+ * .setFlow(flow)
+ * .build();
+ * ApiFuture<Flow> future = flowsClient.createFlowCallable().futureCall(request);
+ * // Do something
+ * Flow response = future.get();
+ * }
+ *
+ *
+ * @param name Required. The name of the flow to delete. Format: `projects/<Project
+ * ID>/locations/<Location ID>/agents/<Agent ID>/flows/<Flow ID>`.
+ * @throws com.google.api.gax.rpc.ApiException if the remote call fails
+ */
+ public final void deleteFlow(FlowName name) {
+ DeleteFlowRequest request =
+ DeleteFlowRequest.newBuilder().setName(name == null ? null : name.toString()).build();
+ deleteFlow(request);
+ }
+
+ // AUTO-GENERATED DOCUMENTATION AND METHOD
+ /**
+ * Deletes a specified flow.
+ *
+ *
+ * try (FlowsClient flowsClient = FlowsClient.create()) {
+ * FlowName name = FlowName.of("[PROJECT]", "[LOCATION]", "[AGENT]", "[FLOW]");
+ * flowsClient.deleteFlow(name);
+ * }
+ *
+ *
+ * @param name Required. The name of the flow to delete. Format: `projects/<Project
+ * ID>/locations/<Location ID>/agents/<Agent ID>/flows/<Flow ID>`.
+ * @throws com.google.api.gax.rpc.ApiException if the remote call fails
+ */
+ public final void deleteFlow(String name) {
+ DeleteFlowRequest request = DeleteFlowRequest.newBuilder().setName(name).build();
+ deleteFlow(request);
+ }
+
+ // AUTO-GENERATED DOCUMENTATION AND METHOD
+ /**
+ * Deletes a specified flow.
+ *
+ *
+ * try (FlowsClient flowsClient = FlowsClient.create()) {
+ * FlowName name = FlowName.of("[PROJECT]", "[LOCATION]", "[AGENT]", "[FLOW]");
+ * flowsClient.deleteFlow(name.toString());
+ * }
+ *
+ *
+ * @param 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
+ */
+ public final void deleteFlow(DeleteFlowRequest request) {
+ deleteFlowCallable().call(request);
+ }
+
+ // AUTO-GENERATED DOCUMENTATION AND METHOD
+ /**
+ * Deletes a specified flow.
+ *
+ *
+ * try (FlowsClient flowsClient = FlowsClient.create()) {
+ * FlowName name = FlowName.of("[PROJECT]", "[LOCATION]", "[AGENT]", "[FLOW]");
+ * DeleteFlowRequest request = DeleteFlowRequest.newBuilder()
+ * .setName(name.toString())
+ * .build();
+ * flowsClient.deleteFlow(request);
+ * }
+ *
+ */
+ public final UnaryCallable
+ * try (FlowsClient flowsClient = FlowsClient.create()) {
+ * FlowName name = FlowName.of("[PROJECT]", "[LOCATION]", "[AGENT]", "[FLOW]");
+ * DeleteFlowRequest request = DeleteFlowRequest.newBuilder()
+ * .setName(name.toString())
+ * .build();
+ * ApiFuture<Void> future = flowsClient.deleteFlowCallable().futureCall(request);
+ * // Do something
+ * future.get();
+ * }
+ *
+ *
+ * @param parent Required. The agent containing the flows. Format: `projects/<Project
+ * ID>/locations/<Location ID>/agents/<Agent ID>`.
+ * @throws com.google.api.gax.rpc.ApiException if the remote call fails
+ */
+ public final ListFlowsPagedResponse listFlows(AgentName parent) {
+ ListFlowsRequest request =
+ ListFlowsRequest.newBuilder().setParent(parent == null ? null : parent.toString()).build();
+ return listFlows(request);
+ }
+
+ // AUTO-GENERATED DOCUMENTATION AND METHOD
+ /**
+ * Returns the list of all flows in the specified agent.
+ *
+ *
+ * try (FlowsClient flowsClient = FlowsClient.create()) {
+ * AgentName parent = AgentName.of("[PROJECT]", "[LOCATION]", "[AGENT]");
+ * for (Flow element : flowsClient.listFlows(parent).iterateAll()) {
+ * // doThingsWith(element);
+ * }
+ * }
+ *
+ *
+ * @param parent Required. The agent containing the flows. Format: `projects/<Project
+ * ID>/locations/<Location ID>/agents/<Agent ID>`.
+ * @throws com.google.api.gax.rpc.ApiException if the remote call fails
+ */
+ public final ListFlowsPagedResponse listFlows(String parent) {
+ ListFlowsRequest request = ListFlowsRequest.newBuilder().setParent(parent).build();
+ return listFlows(request);
+ }
+
+ // AUTO-GENERATED DOCUMENTATION AND METHOD
+ /**
+ * Returns the list of all flows in the specified agent.
+ *
+ *
+ * try (FlowsClient flowsClient = FlowsClient.create()) {
+ * AgentName parent = AgentName.of("[PROJECT]", "[LOCATION]", "[AGENT]");
+ * for (Flow element : flowsClient.listFlows(parent.toString()).iterateAll()) {
+ * // doThingsWith(element);
+ * }
+ * }
+ *
+ *
+ * @param 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
+ */
+ public final ListFlowsPagedResponse listFlows(ListFlowsRequest request) {
+ return listFlowsPagedCallable().call(request);
+ }
+
+ // AUTO-GENERATED DOCUMENTATION AND METHOD
+ /**
+ * Returns the list of all flows in the specified agent.
+ *
+ *
+ * try (FlowsClient flowsClient = FlowsClient.create()) {
+ * AgentName parent = AgentName.of("[PROJECT]", "[LOCATION]", "[AGENT]");
+ * ListFlowsRequest request = ListFlowsRequest.newBuilder()
+ * .setParent(parent.toString())
+ * .build();
+ * for (Flow element : flowsClient.listFlows(request).iterateAll()) {
+ * // doThingsWith(element);
+ * }
+ * }
+ *
+ */
+ public final UnaryCallable
+ * try (FlowsClient flowsClient = FlowsClient.create()) {
+ * AgentName parent = AgentName.of("[PROJECT]", "[LOCATION]", "[AGENT]");
+ * ListFlowsRequest request = ListFlowsRequest.newBuilder()
+ * .setParent(parent.toString())
+ * .build();
+ * ApiFuture<ListFlowsPagedResponse> future = flowsClient.listFlowsPagedCallable().futureCall(request);
+ * // Do something
+ * for (Flow element : future.get().iterateAll()) {
+ * // doThingsWith(element);
+ * }
+ * }
+ *
+ */
+ public final UnaryCallable
+ * try (FlowsClient flowsClient = FlowsClient.create()) {
+ * AgentName parent = AgentName.of("[PROJECT]", "[LOCATION]", "[AGENT]");
+ * ListFlowsRequest request = ListFlowsRequest.newBuilder()
+ * .setParent(parent.toString())
+ * .build();
+ * while (true) {
+ * ListFlowsResponse response = flowsClient.listFlowsCallable().call(request);
+ * for (Flow element : response.getFlowsList()) {
+ * // doThingsWith(element);
+ * }
+ * String nextPageToken = response.getNextPageToken();
+ * if (!Strings.isNullOrEmpty(nextPageToken)) {
+ * request = request.toBuilder().setPageToken(nextPageToken).build();
+ * } else {
+ * break;
+ * }
+ * }
+ * }
+ *
+ *
+ * @param name Required. The name of the flow to get. Format: `projects/<Project
+ * ID>/locations/<Location ID>/agents/<Agent ID>/flows/<Flow ID>`.
+ * @throws com.google.api.gax.rpc.ApiException if the remote call fails
+ */
+ public final Flow getFlow(FlowName name) {
+ GetFlowRequest request =
+ GetFlowRequest.newBuilder().setName(name == null ? null : name.toString()).build();
+ return getFlow(request);
+ }
+
+ // AUTO-GENERATED DOCUMENTATION AND METHOD
+ /**
+ * Retrieves the specified flow.
+ *
+ *
+ * try (FlowsClient flowsClient = FlowsClient.create()) {
+ * FlowName name = FlowName.of("[PROJECT]", "[LOCATION]", "[AGENT]", "[FLOW]");
+ * Flow response = flowsClient.getFlow(name);
+ * }
+ *
+ *
+ * @param name Required. The name of the flow to get. Format: `projects/<Project
+ * ID>/locations/<Location ID>/agents/<Agent ID>/flows/<Flow ID>`.
+ * @throws com.google.api.gax.rpc.ApiException if the remote call fails
+ */
+ public final Flow getFlow(String name) {
+ GetFlowRequest request = GetFlowRequest.newBuilder().setName(name).build();
+ return getFlow(request);
+ }
+
+ // AUTO-GENERATED DOCUMENTATION AND METHOD
+ /**
+ * Retrieves the specified flow.
+ *
+ *
+ * try (FlowsClient flowsClient = FlowsClient.create()) {
+ * FlowName name = FlowName.of("[PROJECT]", "[LOCATION]", "[AGENT]", "[FLOW]");
+ * Flow response = flowsClient.getFlow(name.toString());
+ * }
+ *
+ *
+ * @param 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
+ */
+ public final Flow getFlow(GetFlowRequest request) {
+ return getFlowCallable().call(request);
+ }
+
+ // AUTO-GENERATED DOCUMENTATION AND METHOD
+ /**
+ * Retrieves the specified flow.
+ *
+ *
+ * try (FlowsClient flowsClient = FlowsClient.create()) {
+ * FlowName name = FlowName.of("[PROJECT]", "[LOCATION]", "[AGENT]", "[FLOW]");
+ * GetFlowRequest request = GetFlowRequest.newBuilder()
+ * .setName(name.toString())
+ * .build();
+ * Flow response = flowsClient.getFlow(request);
+ * }
+ *
+ */
+ public final UnaryCallable
+ * try (FlowsClient flowsClient = FlowsClient.create()) {
+ * FlowName name = FlowName.of("[PROJECT]", "[LOCATION]", "[AGENT]", "[FLOW]");
+ * GetFlowRequest request = GetFlowRequest.newBuilder()
+ * .setName(name.toString())
+ * .build();
+ * ApiFuture<Flow> future = flowsClient.getFlowCallable().futureCall(request);
+ * // Do something
+ * Flow response = future.get();
+ * }
+ *
+ *
+ * @param flow Required. The flow to update.
+ * @param updateMask Required. The mask to control which fields get updated. If `update_mask` is
+ * not specified, an error will be returned.
+ * @throws com.google.api.gax.rpc.ApiException if the remote call fails
+ */
+ public final Flow updateFlow(Flow flow, FieldMask updateMask) {
+ UpdateFlowRequest request =
+ UpdateFlowRequest.newBuilder().setFlow(flow).setUpdateMask(updateMask).build();
+ return updateFlow(request);
+ }
+
+ // AUTO-GENERATED DOCUMENTATION AND METHOD
+ /**
+ * Updates the specified flow.
+ *
+ *
+ * try (FlowsClient flowsClient = FlowsClient.create()) {
+ * Flow flow = Flow.newBuilder().build();
+ * FieldMask updateMask = FieldMask.newBuilder().build();
+ * Flow response = flowsClient.updateFlow(flow, updateMask);
+ * }
+ *
+ *
+ * @param 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
+ */
+ public final Flow updateFlow(UpdateFlowRequest request) {
+ return updateFlowCallable().call(request);
+ }
+
+ // AUTO-GENERATED DOCUMENTATION AND METHOD
+ /**
+ * Updates the specified flow.
+ *
+ *
+ * try (FlowsClient flowsClient = FlowsClient.create()) {
+ * Flow flow = Flow.newBuilder().build();
+ * FieldMask updateMask = FieldMask.newBuilder().build();
+ * UpdateFlowRequest request = UpdateFlowRequest.newBuilder()
+ * .setFlow(flow)
+ * .setUpdateMask(updateMask)
+ * .build();
+ * Flow response = flowsClient.updateFlow(request);
+ * }
+ *
+ */
+ public final UnaryCallable
+ * try (FlowsClient flowsClient = FlowsClient.create()) {
+ * Flow flow = Flow.newBuilder().build();
+ * FieldMask updateMask = FieldMask.newBuilder().build();
+ * UpdateFlowRequest request = UpdateFlowRequest.newBuilder()
+ * .setFlow(flow)
+ * .setUpdateMask(updateMask)
+ * .build();
+ * ApiFuture<Flow> future = flowsClient.updateFlowCallable().futureCall(request);
+ * // Do something
+ * Flow response = future.get();
+ * }
+ *
+ *
+ * @param name Required. The flow to train. Format: `projects/<Project
+ * ID>/locations/<Location ID>/agents/<Agent ID>/flows/<Flow ID>`.
+ * @throws com.google.api.gax.rpc.ApiException if the remote call fails
+ */
+ @BetaApi(
+ "The surface for long-running operations is not stable yet and may change in the future.")
+ public final OperationFuture
+ * try (FlowsClient flowsClient = FlowsClient.create()) {
+ * FlowName name = FlowName.of("[PROJECT]", "[LOCATION]", "[AGENT]", "[FLOW]");
+ * flowsClient.trainFlowAsync(name).get();
+ * }
+ *
+ *
+ * @param name Required. The flow to train. Format: `projects/<Project
+ * ID>/locations/<Location ID>/agents/<Agent ID>/flows/<Flow ID>`.
+ * @throws com.google.api.gax.rpc.ApiException if the remote call fails
+ */
+ @BetaApi(
+ "The surface for long-running operations is not stable yet and may change in the future.")
+ public final OperationFuture
+ * try (FlowsClient flowsClient = FlowsClient.create()) {
+ * FlowName name = FlowName.of("[PROJECT]", "[LOCATION]", "[AGENT]", "[FLOW]");
+ * flowsClient.trainFlowAsync(name.toString()).get();
+ * }
+ *
+ *
+ * @param 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
+ */
+ @BetaApi(
+ "The surface for long-running operations is not stable yet and may change in the future.")
+ public final OperationFuture
+ * try (FlowsClient flowsClient = FlowsClient.create()) {
+ * FlowName name = FlowName.of("[PROJECT]", "[LOCATION]", "[AGENT]", "[FLOW]");
+ * TrainFlowRequest request = TrainFlowRequest.newBuilder()
+ * .setName(name.toString())
+ * .build();
+ * flowsClient.trainFlowAsync(request).get();
+ * }
+ *
+ */
+ @BetaApi("The surface for use by generated code is not stable yet and may change in the future.")
+ public final OperationCallable
+ * try (FlowsClient flowsClient = FlowsClient.create()) {
+ * FlowName name = FlowName.of("[PROJECT]", "[LOCATION]", "[AGENT]", "[FLOW]");
+ * TrainFlowRequest request = TrainFlowRequest.newBuilder()
+ * .setName(name.toString())
+ * .build();
+ * OperationFuture<Empty, Struct> future = flowsClient.trainFlowOperationCallable().futureCall(request);
+ * // Do something
+ * future.get();
+ * }
+ *
+ */
+ public final UnaryCallable
+ * try (FlowsClient flowsClient = FlowsClient.create()) {
+ * FlowName name = FlowName.of("[PROJECT]", "[LOCATION]", "[AGENT]", "[FLOW]");
+ * TrainFlowRequest request = TrainFlowRequest.newBuilder()
+ * .setName(name.toString())
+ * .build();
+ * ApiFuture<Operation> future = flowsClient.trainFlowCallable().futureCall(request);
+ * // Do something
+ * future.get();
+ * }
+ *
+ *
+ *
+ *
+ *
+ */
+@Generated("by gapic-generator")
+public class FlowsSettings extends ClientSettings
+ * FlowsSettings.Builder flowsSettingsBuilder =
+ * FlowsSettings.newBuilder();
+ * flowsSettingsBuilder
+ * .createFlowSettings()
+ * .setRetrySettings(
+ * flowsSettingsBuilder.createFlowSettings().getRetrySettings().toBuilder()
+ * .setTotalTimeout(Duration.ofSeconds(30))
+ * .build());
+ * FlowsSettings flowsSettings = flowsSettingsBuilder.build();
+ *
+ *
+ *
+ *
+ *
+ * try (IntentsClient intentsClient = IntentsClient.create()) {
+ * IntentName name = IntentName.of("[PROJECT]", "[LOCATION]", "[AGENT]", "[INTENT]");
+ * Intent response = intentsClient.getIntent(name);
+ * }
+ *
+ *
+ *
+ *
+ *
+ *
+ *
+ * To customize the endpoint:
+ *
+ *
+ * IntentsSettings intentsSettings =
+ * IntentsSettings.newBuilder()
+ * .setCredentialsProvider(FixedCredentialsProvider.create(myCredentials))
+ * .build();
+ * IntentsClient intentsClient =
+ * IntentsClient.create(intentsSettings);
+ *
+ *
+ *
+ */
+@Generated("by gapic-generator")
+public class IntentsClient implements BackgroundResource {
+ private final IntentsSettings settings;
+ private final IntentsStub stub;
+
+ /** Constructs an instance of IntentsClient with default settings. */
+ public static final IntentsClient create() throws IOException {
+ return create(IntentsSettings.newBuilder().build());
+ }
+
+ /**
+ * Constructs an instance of IntentsClient, using the given settings. The channels are created
+ * based on the settings passed in, or defaults for any settings that are not set.
+ */
+ public static final IntentsClient create(IntentsSettings settings) throws IOException {
+ return new IntentsClient(settings);
+ }
+
+ /**
+ * Constructs an instance of IntentsClient, using the given stub for making calls. This is for
+ * advanced usage - prefer to use IntentsSettings}.
+ */
+ @BetaApi("A restructuring of stub classes is planned, so this may break in the future")
+ public static final IntentsClient create(IntentsStub stub) {
+ return new IntentsClient(stub);
+ }
+
+ /**
+ * Constructs an instance of IntentsClient, 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.
+ */
+ protected IntentsClient(IntentsSettings settings) throws IOException {
+ this.settings = settings;
+ this.stub = ((IntentsStubSettings) settings.getStubSettings()).createStub();
+ }
+
+ @BetaApi("A restructuring of stub classes is planned, so this may break in the future")
+ protected IntentsClient(IntentsStub stub) {
+ this.settings = null;
+ this.stub = stub;
+ }
+
+ public final IntentsSettings getSettings() {
+ return settings;
+ }
+
+ @BetaApi("A restructuring of stub classes is planned, so this may break in the future")
+ public IntentsStub getStub() {
+ return stub;
+ }
+
+ // AUTO-GENERATED DOCUMENTATION AND METHOD
+ /**
+ * Returns the list of all intents in the specified agent.
+ *
+ *
+ * IntentsSettings intentsSettings =
+ * IntentsSettings.newBuilder().setEndpoint(myEndpoint).build();
+ * IntentsClient intentsClient =
+ * IntentsClient.create(intentsSettings);
+ *
+ *
+ *
+ * @param parent Required. The agent to list all intents for. Format: `projects/<Project
+ * ID>/locations/<Location ID>/agents/<Agent ID>`.
+ * @throws com.google.api.gax.rpc.ApiException if the remote call fails
+ */
+ public final ListIntentsPagedResponse listIntents(AgentName parent) {
+ ListIntentsRequest request =
+ ListIntentsRequest.newBuilder()
+ .setParent(parent == null ? null : parent.toString())
+ .build();
+ return listIntents(request);
+ }
+
+ // AUTO-GENERATED DOCUMENTATION AND METHOD
+ /**
+ * Returns the list of all intents in the specified agent.
+ *
+ *
+ * try (IntentsClient intentsClient = IntentsClient.create()) {
+ * AgentName parent = AgentName.of("[PROJECT]", "[LOCATION]", "[AGENT]");
+ * for (Intent element : intentsClient.listIntents(parent).iterateAll()) {
+ * // doThingsWith(element);
+ * }
+ * }
+ *
+ *
+ * @param parent Required. The agent to list all intents for. Format: `projects/<Project
+ * ID>/locations/<Location ID>/agents/<Agent ID>`.
+ * @throws com.google.api.gax.rpc.ApiException if the remote call fails
+ */
+ public final ListIntentsPagedResponse listIntents(String parent) {
+ ListIntentsRequest request = ListIntentsRequest.newBuilder().setParent(parent).build();
+ return listIntents(request);
+ }
+
+ // AUTO-GENERATED DOCUMENTATION AND METHOD
+ /**
+ * Returns the list of all intents in the specified agent.
+ *
+ *
+ * try (IntentsClient intentsClient = IntentsClient.create()) {
+ * AgentName parent = AgentName.of("[PROJECT]", "[LOCATION]", "[AGENT]");
+ * for (Intent element : intentsClient.listIntents(parent.toString()).iterateAll()) {
+ * // doThingsWith(element);
+ * }
+ * }
+ *
+ *
+ * @param 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
+ */
+ public final ListIntentsPagedResponse listIntents(ListIntentsRequest request) {
+ return listIntentsPagedCallable().call(request);
+ }
+
+ // AUTO-GENERATED DOCUMENTATION AND METHOD
+ /**
+ * Returns the list of all intents in the specified agent.
+ *
+ *
+ * try (IntentsClient intentsClient = IntentsClient.create()) {
+ * AgentName parent = AgentName.of("[PROJECT]", "[LOCATION]", "[AGENT]");
+ * ListIntentsRequest request = ListIntentsRequest.newBuilder()
+ * .setParent(parent.toString())
+ * .build();
+ * for (Intent element : intentsClient.listIntents(request).iterateAll()) {
+ * // doThingsWith(element);
+ * }
+ * }
+ *
+ */
+ public final UnaryCallable
+ * try (IntentsClient intentsClient = IntentsClient.create()) {
+ * AgentName parent = AgentName.of("[PROJECT]", "[LOCATION]", "[AGENT]");
+ * ListIntentsRequest request = ListIntentsRequest.newBuilder()
+ * .setParent(parent.toString())
+ * .build();
+ * ApiFuture<ListIntentsPagedResponse> future = intentsClient.listIntentsPagedCallable().futureCall(request);
+ * // Do something
+ * for (Intent element : future.get().iterateAll()) {
+ * // doThingsWith(element);
+ * }
+ * }
+ *
+ */
+ public final UnaryCallable
+ * try (IntentsClient intentsClient = IntentsClient.create()) {
+ * AgentName parent = AgentName.of("[PROJECT]", "[LOCATION]", "[AGENT]");
+ * ListIntentsRequest request = ListIntentsRequest.newBuilder()
+ * .setParent(parent.toString())
+ * .build();
+ * while (true) {
+ * ListIntentsResponse response = intentsClient.listIntentsCallable().call(request);
+ * for (Intent element : response.getIntentsList()) {
+ * // doThingsWith(element);
+ * }
+ * String nextPageToken = response.getNextPageToken();
+ * if (!Strings.isNullOrEmpty(nextPageToken)) {
+ * request = request.toBuilder().setPageToken(nextPageToken).build();
+ * } else {
+ * break;
+ * }
+ * }
+ * }
+ *
+ *
+ * @param name Required. The name of the intent. Format: `projects/<Project
+ * ID>/locations/<Location ID>/agents/<Agent ID>/intents/<Intent ID>`.
+ * @throws com.google.api.gax.rpc.ApiException if the remote call fails
+ */
+ public final Intent getIntent(IntentName name) {
+ GetIntentRequest request =
+ GetIntentRequest.newBuilder().setName(name == null ? null : name.toString()).build();
+ return getIntent(request);
+ }
+
+ // AUTO-GENERATED DOCUMENTATION AND METHOD
+ /**
+ * Retrieves the specified intent.
+ *
+ *
+ * try (IntentsClient intentsClient = IntentsClient.create()) {
+ * IntentName name = IntentName.of("[PROJECT]", "[LOCATION]", "[AGENT]", "[INTENT]");
+ * Intent response = intentsClient.getIntent(name);
+ * }
+ *
+ *
+ * @param name Required. The name of the intent. Format: `projects/<Project
+ * ID>/locations/<Location ID>/agents/<Agent ID>/intents/<Intent ID>`.
+ * @throws com.google.api.gax.rpc.ApiException if the remote call fails
+ */
+ public final Intent getIntent(String name) {
+ GetIntentRequest request = GetIntentRequest.newBuilder().setName(name).build();
+ return getIntent(request);
+ }
+
+ // AUTO-GENERATED DOCUMENTATION AND METHOD
+ /**
+ * Retrieves the specified intent.
+ *
+ *
+ * try (IntentsClient intentsClient = IntentsClient.create()) {
+ * IntentName name = IntentName.of("[PROJECT]", "[LOCATION]", "[AGENT]", "[INTENT]");
+ * Intent response = intentsClient.getIntent(name.toString());
+ * }
+ *
+ *
+ * @param 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
+ */
+ public final Intent getIntent(GetIntentRequest request) {
+ return getIntentCallable().call(request);
+ }
+
+ // AUTO-GENERATED DOCUMENTATION AND METHOD
+ /**
+ * Retrieves the specified intent.
+ *
+ *
+ * try (IntentsClient intentsClient = IntentsClient.create()) {
+ * IntentName name = IntentName.of("[PROJECT]", "[LOCATION]", "[AGENT]", "[INTENT]");
+ * GetIntentRequest request = GetIntentRequest.newBuilder()
+ * .setName(name.toString())
+ * .build();
+ * Intent response = intentsClient.getIntent(request);
+ * }
+ *
+ */
+ public final UnaryCallable
+ * try (IntentsClient intentsClient = IntentsClient.create()) {
+ * IntentName name = IntentName.of("[PROJECT]", "[LOCATION]", "[AGENT]", "[INTENT]");
+ * GetIntentRequest request = GetIntentRequest.newBuilder()
+ * .setName(name.toString())
+ * .build();
+ * ApiFuture<Intent> future = intentsClient.getIntentCallable().futureCall(request);
+ * // Do something
+ * Intent response = future.get();
+ * }
+ *
+ *
+ * @param parent Required. The agent to create an intent for. Format: `projects/<Project
+ * ID>/locations/<Location ID>/agents/<Agent ID>`.
+ * @param intent Required. The intent to create.
+ * @throws com.google.api.gax.rpc.ApiException if the remote call fails
+ */
+ public final Intent createIntent(AgentName parent, Intent intent) {
+ CreateIntentRequest request =
+ CreateIntentRequest.newBuilder()
+ .setParent(parent == null ? null : parent.toString())
+ .setIntent(intent)
+ .build();
+ return createIntent(request);
+ }
+
+ // AUTO-GENERATED DOCUMENTATION AND METHOD
+ /**
+ * Creates an intent in the specified agent.
+ *
+ *
+ * try (IntentsClient intentsClient = IntentsClient.create()) {
+ * AgentName parent = AgentName.of("[PROJECT]", "[LOCATION]", "[AGENT]");
+ * Intent intent = Intent.newBuilder().build();
+ * Intent response = intentsClient.createIntent(parent, intent);
+ * }
+ *
+ *
+ * @param parent Required. The agent to create an intent for. Format: `projects/<Project
+ * ID>/locations/<Location ID>/agents/<Agent ID>`.
+ * @param intent Required. The intent to create.
+ * @throws com.google.api.gax.rpc.ApiException if the remote call fails
+ */
+ public final Intent createIntent(String parent, Intent intent) {
+ CreateIntentRequest request =
+ CreateIntentRequest.newBuilder().setParent(parent).setIntent(intent).build();
+ return createIntent(request);
+ }
+
+ // AUTO-GENERATED DOCUMENTATION AND METHOD
+ /**
+ * Creates an intent in the specified agent.
+ *
+ *
+ * try (IntentsClient intentsClient = IntentsClient.create()) {
+ * AgentName parent = AgentName.of("[PROJECT]", "[LOCATION]", "[AGENT]");
+ * Intent intent = Intent.newBuilder().build();
+ * Intent response = intentsClient.createIntent(parent.toString(), intent);
+ * }
+ *
+ *
+ * @param 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
+ */
+ public final Intent createIntent(CreateIntentRequest request) {
+ return createIntentCallable().call(request);
+ }
+
+ // AUTO-GENERATED DOCUMENTATION AND METHOD
+ /**
+ * Creates an intent in the specified agent.
+ *
+ *
+ * try (IntentsClient intentsClient = IntentsClient.create()) {
+ * AgentName parent = AgentName.of("[PROJECT]", "[LOCATION]", "[AGENT]");
+ * Intent intent = Intent.newBuilder().build();
+ * CreateIntentRequest request = CreateIntentRequest.newBuilder()
+ * .setParent(parent.toString())
+ * .setIntent(intent)
+ * .build();
+ * Intent response = intentsClient.createIntent(request);
+ * }
+ *
+ */
+ public final UnaryCallable
+ * try (IntentsClient intentsClient = IntentsClient.create()) {
+ * AgentName parent = AgentName.of("[PROJECT]", "[LOCATION]", "[AGENT]");
+ * Intent intent = Intent.newBuilder().build();
+ * CreateIntentRequest request = CreateIntentRequest.newBuilder()
+ * .setParent(parent.toString())
+ * .setIntent(intent)
+ * .build();
+ * ApiFuture<Intent> future = intentsClient.createIntentCallable().futureCall(request);
+ * // Do something
+ * Intent response = future.get();
+ * }
+ *
+ *
+ * @param intent Required. The intent to update.
+ * @param updateMask The mask to control which fields get updated. If the mask is not present, all
+ * fields will be updated.
+ * @throws com.google.api.gax.rpc.ApiException if the remote call fails
+ */
+ public final Intent updateIntent(Intent intent, FieldMask updateMask) {
+ UpdateIntentRequest request =
+ UpdateIntentRequest.newBuilder().setIntent(intent).setUpdateMask(updateMask).build();
+ return updateIntent(request);
+ }
+
+ // AUTO-GENERATED DOCUMENTATION AND METHOD
+ /**
+ * Updates the specified intent.
+ *
+ *
+ * try (IntentsClient intentsClient = IntentsClient.create()) {
+ * Intent intent = Intent.newBuilder().build();
+ * FieldMask updateMask = FieldMask.newBuilder().build();
+ * Intent response = intentsClient.updateIntent(intent, updateMask);
+ * }
+ *
+ *
+ * @param 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
+ */
+ public final Intent updateIntent(UpdateIntentRequest request) {
+ return updateIntentCallable().call(request);
+ }
+
+ // AUTO-GENERATED DOCUMENTATION AND METHOD
+ /**
+ * Updates the specified intent.
+ *
+ *
+ * try (IntentsClient intentsClient = IntentsClient.create()) {
+ * Intent intent = Intent.newBuilder().build();
+ * UpdateIntentRequest request = UpdateIntentRequest.newBuilder()
+ * .setIntent(intent)
+ * .build();
+ * Intent response = intentsClient.updateIntent(request);
+ * }
+ *
+ */
+ public final UnaryCallable
+ * try (IntentsClient intentsClient = IntentsClient.create()) {
+ * Intent intent = Intent.newBuilder().build();
+ * UpdateIntentRequest request = UpdateIntentRequest.newBuilder()
+ * .setIntent(intent)
+ * .build();
+ * ApiFuture<Intent> future = intentsClient.updateIntentCallable().futureCall(request);
+ * // Do something
+ * Intent response = future.get();
+ * }
+ *
+ *
+ * @param name Required. The name of the intent to delete. Format: `projects/<Project
+ * ID>/locations/<Location ID>/agents/<Agent ID>/intents/<Intent ID>`.
+ * @throws com.google.api.gax.rpc.ApiException if the remote call fails
+ */
+ public final void deleteIntent(IntentName name) {
+ DeleteIntentRequest request =
+ DeleteIntentRequest.newBuilder().setName(name == null ? null : name.toString()).build();
+ deleteIntent(request);
+ }
+
+ // AUTO-GENERATED DOCUMENTATION AND METHOD
+ /**
+ * Deletes the specified intent.
+ *
+ *
+ * try (IntentsClient intentsClient = IntentsClient.create()) {
+ * IntentName name = IntentName.of("[PROJECT]", "[LOCATION]", "[AGENT]", "[INTENT]");
+ * intentsClient.deleteIntent(name);
+ * }
+ *
+ *
+ * @param name Required. The name of the intent to delete. Format: `projects/<Project
+ * ID>/locations/<Location ID>/agents/<Agent ID>/intents/<Intent ID>`.
+ * @throws com.google.api.gax.rpc.ApiException if the remote call fails
+ */
+ public final void deleteIntent(String name) {
+ DeleteIntentRequest request = DeleteIntentRequest.newBuilder().setName(name).build();
+ deleteIntent(request);
+ }
+
+ // AUTO-GENERATED DOCUMENTATION AND METHOD
+ /**
+ * Deletes the specified intent.
+ *
+ *
+ * try (IntentsClient intentsClient = IntentsClient.create()) {
+ * IntentName name = IntentName.of("[PROJECT]", "[LOCATION]", "[AGENT]", "[INTENT]");
+ * intentsClient.deleteIntent(name.toString());
+ * }
+ *
+ *
+ * @param 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
+ */
+ public final void deleteIntent(DeleteIntentRequest request) {
+ deleteIntentCallable().call(request);
+ }
+
+ // AUTO-GENERATED DOCUMENTATION AND METHOD
+ /**
+ * Deletes the specified intent.
+ *
+ *
+ * try (IntentsClient intentsClient = IntentsClient.create()) {
+ * IntentName name = IntentName.of("[PROJECT]", "[LOCATION]", "[AGENT]", "[INTENT]");
+ * DeleteIntentRequest request = DeleteIntentRequest.newBuilder()
+ * .setName(name.toString())
+ * .build();
+ * intentsClient.deleteIntent(request);
+ * }
+ *
+ */
+ public final UnaryCallable
+ * try (IntentsClient intentsClient = IntentsClient.create()) {
+ * IntentName name = IntentName.of("[PROJECT]", "[LOCATION]", "[AGENT]", "[INTENT]");
+ * DeleteIntentRequest request = DeleteIntentRequest.newBuilder()
+ * .setName(name.toString())
+ * .build();
+ * ApiFuture<Void> future = intentsClient.deleteIntentCallable().futureCall(request);
+ * // Do something
+ * future.get();
+ * }
+ *
+ *
+ *
+ *
+ *
+ */
+@Generated("by gapic-generator")
+public class IntentsSettings extends ClientSettings
+ * IntentsSettings.Builder intentsSettingsBuilder =
+ * IntentsSettings.newBuilder();
+ * intentsSettingsBuilder
+ * .getIntentSettings()
+ * .setRetrySettings(
+ * intentsSettingsBuilder.getIntentSettings().getRetrySettings().toBuilder()
+ * .setTotalTimeout(Duration.ofSeconds(30))
+ * .build());
+ * IntentsSettings intentsSettings = intentsSettingsBuilder.build();
+ *
+ *
+ *
+ *
+ *
+ * try (PagesClient pagesClient = PagesClient.create()) {
+ * PageName name = PageName.of("[PROJECT]", "[LOCATION]", "[AGENT]", "[FLOW]", "[PAGE]");
+ * Page response = pagesClient.getPage(name);
+ * }
+ *
+ *
+ *
+ *
+ *
+ *
+ *
+ * To customize the endpoint:
+ *
+ *
+ * PagesSettings pagesSettings =
+ * PagesSettings.newBuilder()
+ * .setCredentialsProvider(FixedCredentialsProvider.create(myCredentials))
+ * .build();
+ * PagesClient pagesClient =
+ * PagesClient.create(pagesSettings);
+ *
+ *
+ *
+ */
+@Generated("by gapic-generator")
+public class PagesClient implements BackgroundResource {
+ private final PagesSettings settings;
+ private final PagesStub stub;
+
+ /** Constructs an instance of PagesClient with default settings. */
+ public static final PagesClient create() throws IOException {
+ return create(PagesSettings.newBuilder().build());
+ }
+
+ /**
+ * Constructs an instance of PagesClient, using the given settings. The channels are created based
+ * on the settings passed in, or defaults for any settings that are not set.
+ */
+ public static final PagesClient create(PagesSettings settings) throws IOException {
+ return new PagesClient(settings);
+ }
+
+ /**
+ * Constructs an instance of PagesClient, using the given stub for making calls. This is for
+ * advanced usage - prefer to use PagesSettings}.
+ */
+ @BetaApi("A restructuring of stub classes is planned, so this may break in the future")
+ public static final PagesClient create(PagesStub stub) {
+ return new PagesClient(stub);
+ }
+
+ /**
+ * Constructs an instance of PagesClient, 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.
+ */
+ protected PagesClient(PagesSettings settings) throws IOException {
+ this.settings = settings;
+ this.stub = ((PagesStubSettings) settings.getStubSettings()).createStub();
+ }
+
+ @BetaApi("A restructuring of stub classes is planned, so this may break in the future")
+ protected PagesClient(PagesStub stub) {
+ this.settings = null;
+ this.stub = stub;
+ }
+
+ public final PagesSettings getSettings() {
+ return settings;
+ }
+
+ @BetaApi("A restructuring of stub classes is planned, so this may break in the future")
+ public PagesStub getStub() {
+ return stub;
+ }
+
+ // AUTO-GENERATED DOCUMENTATION AND METHOD
+ /**
+ * Returns the list of all pages in the specified flow.
+ *
+ *
+ * PagesSettings pagesSettings =
+ * PagesSettings.newBuilder().setEndpoint(myEndpoint).build();
+ * PagesClient pagesClient =
+ * PagesClient.create(pagesSettings);
+ *
+ *
+ *
+ * @param parent Required. The flow to list all pages for. Format: `projects/<Project
+ * ID>/locations/<Location ID>/agents/<Agent ID>/flows/<Flow ID>`.
+ * @throws com.google.api.gax.rpc.ApiException if the remote call fails
+ */
+ public final ListPagesPagedResponse listPages(FlowName parent) {
+ ListPagesRequest request =
+ ListPagesRequest.newBuilder().setParent(parent == null ? null : parent.toString()).build();
+ return listPages(request);
+ }
+
+ // AUTO-GENERATED DOCUMENTATION AND METHOD
+ /**
+ * Returns the list of all pages in the specified flow.
+ *
+ *
+ * try (PagesClient pagesClient = PagesClient.create()) {
+ * FlowName parent = FlowName.of("[PROJECT]", "[LOCATION]", "[AGENT]", "[FLOW]");
+ * for (Page element : pagesClient.listPages(parent).iterateAll()) {
+ * // doThingsWith(element);
+ * }
+ * }
+ *
+ *
+ * @param parent Required. The flow to list all pages for. Format: `projects/<Project
+ * ID>/locations/<Location ID>/agents/<Agent ID>/flows/<Flow ID>`.
+ * @throws com.google.api.gax.rpc.ApiException if the remote call fails
+ */
+ public final ListPagesPagedResponse listPages(String parent) {
+ ListPagesRequest request = ListPagesRequest.newBuilder().setParent(parent).build();
+ return listPages(request);
+ }
+
+ // AUTO-GENERATED DOCUMENTATION AND METHOD
+ /**
+ * Returns the list of all pages in the specified flow.
+ *
+ *
+ * try (PagesClient pagesClient = PagesClient.create()) {
+ * FlowName parent = FlowName.of("[PROJECT]", "[LOCATION]", "[AGENT]", "[FLOW]");
+ * for (Page element : pagesClient.listPages(parent.toString()).iterateAll()) {
+ * // doThingsWith(element);
+ * }
+ * }
+ *
+ *
+ * @param 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
+ */
+ public final ListPagesPagedResponse listPages(ListPagesRequest request) {
+ return listPagesPagedCallable().call(request);
+ }
+
+ // AUTO-GENERATED DOCUMENTATION AND METHOD
+ /**
+ * Returns the list of all pages in the specified flow.
+ *
+ *
+ * try (PagesClient pagesClient = PagesClient.create()) {
+ * FlowName parent = FlowName.of("[PROJECT]", "[LOCATION]", "[AGENT]", "[FLOW]");
+ * ListPagesRequest request = ListPagesRequest.newBuilder()
+ * .setParent(parent.toString())
+ * .build();
+ * for (Page element : pagesClient.listPages(request).iterateAll()) {
+ * // doThingsWith(element);
+ * }
+ * }
+ *
+ */
+ public final UnaryCallable
+ * try (PagesClient pagesClient = PagesClient.create()) {
+ * FlowName parent = FlowName.of("[PROJECT]", "[LOCATION]", "[AGENT]", "[FLOW]");
+ * ListPagesRequest request = ListPagesRequest.newBuilder()
+ * .setParent(parent.toString())
+ * .build();
+ * ApiFuture<ListPagesPagedResponse> future = pagesClient.listPagesPagedCallable().futureCall(request);
+ * // Do something
+ * for (Page element : future.get().iterateAll()) {
+ * // doThingsWith(element);
+ * }
+ * }
+ *
+ */
+ public final UnaryCallable
+ * try (PagesClient pagesClient = PagesClient.create()) {
+ * FlowName parent = FlowName.of("[PROJECT]", "[LOCATION]", "[AGENT]", "[FLOW]");
+ * ListPagesRequest request = ListPagesRequest.newBuilder()
+ * .setParent(parent.toString())
+ * .build();
+ * while (true) {
+ * ListPagesResponse response = pagesClient.listPagesCallable().call(request);
+ * for (Page element : response.getPagesList()) {
+ * // doThingsWith(element);
+ * }
+ * String nextPageToken = response.getNextPageToken();
+ * if (!Strings.isNullOrEmpty(nextPageToken)) {
+ * request = request.toBuilder().setPageToken(nextPageToken).build();
+ * } else {
+ * break;
+ * }
+ * }
+ * }
+ *
+ *
+ * @param name Required. The name of the page. Format: `projects/<Project
+ * ID>/locations/<Location ID>/agents/<Agent ID>/flows/<Flow
+ * ID>/pages/<Page ID>`.
+ * @throws com.google.api.gax.rpc.ApiException if the remote call fails
+ */
+ public final Page getPage(PageName name) {
+ GetPageRequest request =
+ GetPageRequest.newBuilder().setName(name == null ? null : name.toString()).build();
+ return getPage(request);
+ }
+
+ // AUTO-GENERATED DOCUMENTATION AND METHOD
+ /**
+ * Retrieves the specified page.
+ *
+ *
+ * try (PagesClient pagesClient = PagesClient.create()) {
+ * PageName name = PageName.of("[PROJECT]", "[LOCATION]", "[AGENT]", "[FLOW]", "[PAGE]");
+ * Page response = pagesClient.getPage(name);
+ * }
+ *
+ *
+ * @param name Required. The name of the page. Format: `projects/<Project
+ * ID>/locations/<Location ID>/agents/<Agent ID>/flows/<Flow
+ * ID>/pages/<Page ID>`.
+ * @throws com.google.api.gax.rpc.ApiException if the remote call fails
+ */
+ public final Page getPage(String name) {
+ GetPageRequest request = GetPageRequest.newBuilder().setName(name).build();
+ return getPage(request);
+ }
+
+ // AUTO-GENERATED DOCUMENTATION AND METHOD
+ /**
+ * Retrieves the specified page.
+ *
+ *
+ * try (PagesClient pagesClient = PagesClient.create()) {
+ * PageName name = PageName.of("[PROJECT]", "[LOCATION]", "[AGENT]", "[FLOW]", "[PAGE]");
+ * Page response = pagesClient.getPage(name.toString());
+ * }
+ *
+ *
+ * @param 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
+ */
+ public final Page getPage(GetPageRequest request) {
+ return getPageCallable().call(request);
+ }
+
+ // AUTO-GENERATED DOCUMENTATION AND METHOD
+ /**
+ * Retrieves the specified page.
+ *
+ *
+ * try (PagesClient pagesClient = PagesClient.create()) {
+ * PageName name = PageName.of("[PROJECT]", "[LOCATION]", "[AGENT]", "[FLOW]", "[PAGE]");
+ * GetPageRequest request = GetPageRequest.newBuilder()
+ * .setName(name.toString())
+ * .build();
+ * Page response = pagesClient.getPage(request);
+ * }
+ *
+ */
+ public final UnaryCallable
+ * try (PagesClient pagesClient = PagesClient.create()) {
+ * PageName name = PageName.of("[PROJECT]", "[LOCATION]", "[AGENT]", "[FLOW]", "[PAGE]");
+ * GetPageRequest request = GetPageRequest.newBuilder()
+ * .setName(name.toString())
+ * .build();
+ * ApiFuture<Page> future = pagesClient.getPageCallable().futureCall(request);
+ * // Do something
+ * Page response = future.get();
+ * }
+ *
+ *
+ * @param parent Required. The flow to create a page for. Format: `projects/<Project
+ * ID>/locations/<Location ID>/agents/<Agent ID>/flows/<Flow ID>`.
+ * @param page Required. The page to create.
+ * @throws com.google.api.gax.rpc.ApiException if the remote call fails
+ */
+ public final Page createPage(FlowName parent, Page page) {
+ CreatePageRequest request =
+ CreatePageRequest.newBuilder()
+ .setParent(parent == null ? null : parent.toString())
+ .setPage(page)
+ .build();
+ return createPage(request);
+ }
+
+ // AUTO-GENERATED DOCUMENTATION AND METHOD
+ /**
+ * Creates a page in the specified flow.
+ *
+ *
+ * try (PagesClient pagesClient = PagesClient.create()) {
+ * FlowName parent = FlowName.of("[PROJECT]", "[LOCATION]", "[AGENT]", "[FLOW]");
+ * Page page = Page.newBuilder().build();
+ * Page response = pagesClient.createPage(parent, page);
+ * }
+ *
+ *
+ * @param parent Required. The flow to create a page for. Format: `projects/<Project
+ * ID>/locations/<Location ID>/agents/<Agent ID>/flows/<Flow ID>`.
+ * @param page Required. The page to create.
+ * @throws com.google.api.gax.rpc.ApiException if the remote call fails
+ */
+ public final Page createPage(String parent, Page page) {
+ CreatePageRequest request =
+ CreatePageRequest.newBuilder().setParent(parent).setPage(page).build();
+ return createPage(request);
+ }
+
+ // AUTO-GENERATED DOCUMENTATION AND METHOD
+ /**
+ * Creates a page in the specified flow.
+ *
+ *
+ * try (PagesClient pagesClient = PagesClient.create()) {
+ * FlowName parent = FlowName.of("[PROJECT]", "[LOCATION]", "[AGENT]", "[FLOW]");
+ * Page page = Page.newBuilder().build();
+ * Page response = pagesClient.createPage(parent.toString(), page);
+ * }
+ *
+ *
+ * @param 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
+ */
+ public final Page createPage(CreatePageRequest request) {
+ return createPageCallable().call(request);
+ }
+
+ // AUTO-GENERATED DOCUMENTATION AND METHOD
+ /**
+ * Creates a page in the specified flow.
+ *
+ *
+ * try (PagesClient pagesClient = PagesClient.create()) {
+ * FlowName parent = FlowName.of("[PROJECT]", "[LOCATION]", "[AGENT]", "[FLOW]");
+ * Page page = Page.newBuilder().build();
+ * CreatePageRequest request = CreatePageRequest.newBuilder()
+ * .setParent(parent.toString())
+ * .setPage(page)
+ * .build();
+ * Page response = pagesClient.createPage(request);
+ * }
+ *
+ */
+ public final UnaryCallable
+ * try (PagesClient pagesClient = PagesClient.create()) {
+ * FlowName parent = FlowName.of("[PROJECT]", "[LOCATION]", "[AGENT]", "[FLOW]");
+ * Page page = Page.newBuilder().build();
+ * CreatePageRequest request = CreatePageRequest.newBuilder()
+ * .setParent(parent.toString())
+ * .setPage(page)
+ * .build();
+ * ApiFuture<Page> future = pagesClient.createPageCallable().futureCall(request);
+ * // Do something
+ * Page response = future.get();
+ * }
+ *
+ *
+ * @param page Required. The page to update.
+ * @param updateMask The mask to control which fields get updated. If the mask is not present, all
+ * fields will be updated.
+ * @throws com.google.api.gax.rpc.ApiException if the remote call fails
+ */
+ public final Page updatePage(Page page, FieldMask updateMask) {
+ UpdatePageRequest request =
+ UpdatePageRequest.newBuilder().setPage(page).setUpdateMask(updateMask).build();
+ return updatePage(request);
+ }
+
+ // AUTO-GENERATED DOCUMENTATION AND METHOD
+ /**
+ * Updates the specified page.
+ *
+ *
+ * try (PagesClient pagesClient = PagesClient.create()) {
+ * Page page = Page.newBuilder().build();
+ * FieldMask updateMask = FieldMask.newBuilder().build();
+ * Page response = pagesClient.updatePage(page, updateMask);
+ * }
+ *
+ *
+ * @param 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
+ */
+ public final Page updatePage(UpdatePageRequest request) {
+ return updatePageCallable().call(request);
+ }
+
+ // AUTO-GENERATED DOCUMENTATION AND METHOD
+ /**
+ * Updates the specified page.
+ *
+ *
+ * try (PagesClient pagesClient = PagesClient.create()) {
+ * Page page = Page.newBuilder().build();
+ * UpdatePageRequest request = UpdatePageRequest.newBuilder()
+ * .setPage(page)
+ * .build();
+ * Page response = pagesClient.updatePage(request);
+ * }
+ *
+ */
+ public final UnaryCallable
+ * try (PagesClient pagesClient = PagesClient.create()) {
+ * Page page = Page.newBuilder().build();
+ * UpdatePageRequest request = UpdatePageRequest.newBuilder()
+ * .setPage(page)
+ * .build();
+ * ApiFuture<Page> future = pagesClient.updatePageCallable().futureCall(request);
+ * // Do something
+ * Page response = future.get();
+ * }
+ *
+ *
+ * @param name Required. The name of the page to delete. Format: `projects/<Project
+ * ID>/locations/<Location ID>/agents/<Agent ID>/Flows/<flow
+ * ID>/pages/<Page ID>`.
+ * @throws com.google.api.gax.rpc.ApiException if the remote call fails
+ */
+ public final void deletePage(PageName name) {
+ DeletePageRequest request =
+ DeletePageRequest.newBuilder().setName(name == null ? null : name.toString()).build();
+ deletePage(request);
+ }
+
+ // AUTO-GENERATED DOCUMENTATION AND METHOD
+ /**
+ * Deletes the specified page.
+ *
+ *
+ * try (PagesClient pagesClient = PagesClient.create()) {
+ * PageName name = PageName.of("[PROJECT]", "[LOCATION]", "[AGENT]", "[FLOW]", "[PAGE]");
+ * pagesClient.deletePage(name);
+ * }
+ *
+ *
+ * @param name Required. The name of the page to delete. Format: `projects/<Project
+ * ID>/locations/<Location ID>/agents/<Agent ID>/Flows/<flow
+ * ID>/pages/<Page ID>`.
+ * @throws com.google.api.gax.rpc.ApiException if the remote call fails
+ */
+ public final void deletePage(String name) {
+ DeletePageRequest request = DeletePageRequest.newBuilder().setName(name).build();
+ deletePage(request);
+ }
+
+ // AUTO-GENERATED DOCUMENTATION AND METHOD
+ /**
+ * Deletes the specified page.
+ *
+ *
+ * try (PagesClient pagesClient = PagesClient.create()) {
+ * PageName name = PageName.of("[PROJECT]", "[LOCATION]", "[AGENT]", "[FLOW]", "[PAGE]");
+ * pagesClient.deletePage(name.toString());
+ * }
+ *
+ *
+ * @param 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
+ */
+ public final void deletePage(DeletePageRequest request) {
+ deletePageCallable().call(request);
+ }
+
+ // AUTO-GENERATED DOCUMENTATION AND METHOD
+ /**
+ * Deletes the specified page.
+ *
+ *
+ * try (PagesClient pagesClient = PagesClient.create()) {
+ * PageName name = PageName.of("[PROJECT]", "[LOCATION]", "[AGENT]", "[FLOW]", "[PAGE]");
+ * DeletePageRequest request = DeletePageRequest.newBuilder()
+ * .setName(name.toString())
+ * .build();
+ * pagesClient.deletePage(request);
+ * }
+ *
+ */
+ public final UnaryCallable
+ * try (PagesClient pagesClient = PagesClient.create()) {
+ * PageName name = PageName.of("[PROJECT]", "[LOCATION]", "[AGENT]", "[FLOW]", "[PAGE]");
+ * DeletePageRequest request = DeletePageRequest.newBuilder()
+ * .setName(name.toString())
+ * .build();
+ * ApiFuture<Void> future = pagesClient.deletePageCallable().futureCall(request);
+ * // Do something
+ * future.get();
+ * }
+ *
+ *
+ *
+ *
+ *
+ */
+@Generated("by gapic-generator")
+public class PagesSettings extends ClientSettings
+ * PagesSettings.Builder pagesSettingsBuilder =
+ * PagesSettings.newBuilder();
+ * pagesSettingsBuilder
+ * .getPageSettings()
+ * .setRetrySettings(
+ * pagesSettingsBuilder.getPageSettings().getRetrySettings().toBuilder()
+ * .setTotalTimeout(Duration.ofSeconds(30))
+ * .build());
+ * PagesSettings pagesSettings = pagesSettingsBuilder.build();
+ *
+ *
+ *
+ *
+ *
+ * try (SecuritySettingsServiceClient securitySettingsServiceClient = SecuritySettingsServiceClient.create()) {
+ * LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]");
+ * SecuritySettings securitySettings = SecuritySettings.newBuilder().build();
+ * SecuritySettings response = securitySettingsServiceClient.createSecuritySettings(parent, securitySettings);
+ * }
+ *
+ *
+ *
+ *
+ *
+ *
+ *
+ * To customize the endpoint:
+ *
+ *
+ * SecuritySettingsServiceSettings securitySettingsServiceSettings =
+ * SecuritySettingsServiceSettings.newBuilder()
+ * .setCredentialsProvider(FixedCredentialsProvider.create(myCredentials))
+ * .build();
+ * SecuritySettingsServiceClient securitySettingsServiceClient =
+ * SecuritySettingsServiceClient.create(securitySettingsServiceSettings);
+ *
+ *
+ *
+ */
+@Generated("by gapic-generator")
+public class SecuritySettingsServiceClient implements BackgroundResource {
+ private final SecuritySettingsServiceSettings settings;
+ private final SecuritySettingsServiceStub stub;
+
+ /** Constructs an instance of SecuritySettingsServiceClient with default settings. */
+ public static final SecuritySettingsServiceClient create() throws IOException {
+ return create(SecuritySettingsServiceSettings.newBuilder().build());
+ }
+
+ /**
+ * Constructs an instance of SecuritySettingsServiceClient, using the given settings. The channels
+ * are created based on the settings passed in, or defaults for any settings that are not set.
+ */
+ public static final SecuritySettingsServiceClient create(SecuritySettingsServiceSettings settings)
+ throws IOException {
+ return new SecuritySettingsServiceClient(settings);
+ }
+
+ /**
+ * Constructs an instance of SecuritySettingsServiceClient, using the given stub for making calls.
+ * This is for advanced usage - prefer to use SecuritySettingsServiceSettings}.
+ */
+ @BetaApi("A restructuring of stub classes is planned, so this may break in the future")
+ public static final SecuritySettingsServiceClient create(SecuritySettingsServiceStub stub) {
+ return new SecuritySettingsServiceClient(stub);
+ }
+
+ /**
+ * Constructs an instance of SecuritySettingsServiceClient, 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.
+ */
+ protected SecuritySettingsServiceClient(SecuritySettingsServiceSettings settings)
+ throws IOException {
+ this.settings = settings;
+ this.stub = ((SecuritySettingsServiceStubSettings) settings.getStubSettings()).createStub();
+ }
+
+ @BetaApi("A restructuring of stub classes is planned, so this may break in the future")
+ protected SecuritySettingsServiceClient(SecuritySettingsServiceStub stub) {
+ this.settings = null;
+ this.stub = stub;
+ }
+
+ public final SecuritySettingsServiceSettings getSettings() {
+ return settings;
+ }
+
+ @BetaApi("A restructuring of stub classes is planned, so this may break in the future")
+ public SecuritySettingsServiceStub getStub() {
+ return stub;
+ }
+
+ // AUTO-GENERATED DOCUMENTATION AND METHOD
+ /**
+ * Create security settings in the specified location.
+ *
+ *
+ * SecuritySettingsServiceSettings securitySettingsServiceSettings =
+ * SecuritySettingsServiceSettings.newBuilder().setEndpoint(myEndpoint).build();
+ * SecuritySettingsServiceClient securitySettingsServiceClient =
+ * SecuritySettingsServiceClient.create(securitySettingsServiceSettings);
+ *
+ *
+ *
+ * @param parent Required. The location to create an
+ * [SecuritySettings][google.cloud.dialogflow.cx.v3.SecuritySettings] for. Format:
+ * `projects/<Project ID>/locations/<Location ID>`.
+ * @param securitySettings Required. The security settings to create.
+ * @throws com.google.api.gax.rpc.ApiException if the remote call fails
+ */
+ public final SecuritySettings createSecuritySettings(
+ LocationName parent, SecuritySettings securitySettings) {
+ CreateSecuritySettingsRequest request =
+ CreateSecuritySettingsRequest.newBuilder()
+ .setParent(parent == null ? null : parent.toString())
+ .setSecuritySettings(securitySettings)
+ .build();
+ return createSecuritySettings(request);
+ }
+
+ // AUTO-GENERATED DOCUMENTATION AND METHOD
+ /**
+ * Create security settings in the specified location.
+ *
+ *
+ * try (SecuritySettingsServiceClient securitySettingsServiceClient = SecuritySettingsServiceClient.create()) {
+ * LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]");
+ * SecuritySettings securitySettings = SecuritySettings.newBuilder().build();
+ * SecuritySettings response = securitySettingsServiceClient.createSecuritySettings(parent, securitySettings);
+ * }
+ *
+ *
+ * @param parent Required. The location to create an
+ * [SecuritySettings][google.cloud.dialogflow.cx.v3.SecuritySettings] for. Format:
+ * `projects/<Project ID>/locations/<Location ID>`.
+ * @param securitySettings Required. The security settings to create.
+ * @throws com.google.api.gax.rpc.ApiException if the remote call fails
+ */
+ public final SecuritySettings createSecuritySettings(
+ String parent, SecuritySettings securitySettings) {
+ CreateSecuritySettingsRequest request =
+ CreateSecuritySettingsRequest.newBuilder()
+ .setParent(parent)
+ .setSecuritySettings(securitySettings)
+ .build();
+ return createSecuritySettings(request);
+ }
+
+ // AUTO-GENERATED DOCUMENTATION AND METHOD
+ /**
+ * Create security settings in the specified location.
+ *
+ *
+ * try (SecuritySettingsServiceClient securitySettingsServiceClient = SecuritySettingsServiceClient.create()) {
+ * LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]");
+ * SecuritySettings securitySettings = SecuritySettings.newBuilder().build();
+ * SecuritySettings response = securitySettingsServiceClient.createSecuritySettings(parent.toString(), securitySettings);
+ * }
+ *
+ *
+ * @param 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
+ */
+ public final SecuritySettings createSecuritySettings(CreateSecuritySettingsRequest request) {
+ return createSecuritySettingsCallable().call(request);
+ }
+
+ // AUTO-GENERATED DOCUMENTATION AND METHOD
+ /**
+ * Create security settings in the specified location.
+ *
+ *
+ * try (SecuritySettingsServiceClient securitySettingsServiceClient = SecuritySettingsServiceClient.create()) {
+ * LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]");
+ * SecuritySettings securitySettings = SecuritySettings.newBuilder().build();
+ * CreateSecuritySettingsRequest request = CreateSecuritySettingsRequest.newBuilder()
+ * .setParent(parent.toString())
+ * .setSecuritySettings(securitySettings)
+ * .build();
+ * SecuritySettings response = securitySettingsServiceClient.createSecuritySettings(request);
+ * }
+ *
+ */
+ public final UnaryCallable
+ * try (SecuritySettingsServiceClient securitySettingsServiceClient = SecuritySettingsServiceClient.create()) {
+ * LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]");
+ * SecuritySettings securitySettings = SecuritySettings.newBuilder().build();
+ * CreateSecuritySettingsRequest request = CreateSecuritySettingsRequest.newBuilder()
+ * .setParent(parent.toString())
+ * .setSecuritySettings(securitySettings)
+ * .build();
+ * ApiFuture<SecuritySettings> future = securitySettingsServiceClient.createSecuritySettingsCallable().futureCall(request);
+ * // Do something
+ * SecuritySettings response = future.get();
+ * }
+ *
+ *
+ * @param name Required. Resource name of the settings. Format: `projects/<Project
+ * ID>/locations/<Location ID>/securitySettings/<security settings ID>`.
+ * @throws com.google.api.gax.rpc.ApiException if the remote call fails
+ */
+ public final SecuritySettings getSecuritySettings(SecuritySettingsName name) {
+ GetSecuritySettingsRequest request =
+ GetSecuritySettingsRequest.newBuilder()
+ .setName(name == null ? null : name.toString())
+ .build();
+ return getSecuritySettings(request);
+ }
+
+ // AUTO-GENERATED DOCUMENTATION AND METHOD
+ /**
+ * Retrieves the specified [SecuritySettings][google.cloud.dialogflow.cx.v3.SecuritySettings]. The
+ * returned settings may be stale by up to 1 minute.
+ *
+ *
+ * try (SecuritySettingsServiceClient securitySettingsServiceClient = SecuritySettingsServiceClient.create()) {
+ * SecuritySettingsName name = SecuritySettingsName.of("[PROJECT]", "[LOCATION]", "[SECURITY_SETTINGS]");
+ * SecuritySettings response = securitySettingsServiceClient.getSecuritySettings(name);
+ * }
+ *
+ *
+ * @param name Required. Resource name of the settings. Format: `projects/<Project
+ * ID>/locations/<Location ID>/securitySettings/<security settings ID>`.
+ * @throws com.google.api.gax.rpc.ApiException if the remote call fails
+ */
+ public final SecuritySettings getSecuritySettings(String name) {
+ GetSecuritySettingsRequest request =
+ GetSecuritySettingsRequest.newBuilder().setName(name).build();
+ return getSecuritySettings(request);
+ }
+
+ // AUTO-GENERATED DOCUMENTATION AND METHOD
+ /**
+ * Retrieves the specified [SecuritySettings][google.cloud.dialogflow.cx.v3.SecuritySettings]. The
+ * returned settings may be stale by up to 1 minute.
+ *
+ *
+ * try (SecuritySettingsServiceClient securitySettingsServiceClient = SecuritySettingsServiceClient.create()) {
+ * SecuritySettingsName name = SecuritySettingsName.of("[PROJECT]", "[LOCATION]", "[SECURITY_SETTINGS]");
+ * SecuritySettings response = securitySettingsServiceClient.getSecuritySettings(name.toString());
+ * }
+ *
+ *
+ * @param 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
+ */
+ public final SecuritySettings getSecuritySettings(GetSecuritySettingsRequest request) {
+ return getSecuritySettingsCallable().call(request);
+ }
+
+ // AUTO-GENERATED DOCUMENTATION AND METHOD
+ /**
+ * Retrieves the specified [SecuritySettings][google.cloud.dialogflow.cx.v3.SecuritySettings]. The
+ * returned settings may be stale by up to 1 minute.
+ *
+ *
+ * try (SecuritySettingsServiceClient securitySettingsServiceClient = SecuritySettingsServiceClient.create()) {
+ * SecuritySettingsName name = SecuritySettingsName.of("[PROJECT]", "[LOCATION]", "[SECURITY_SETTINGS]");
+ * GetSecuritySettingsRequest request = GetSecuritySettingsRequest.newBuilder()
+ * .setName(name.toString())
+ * .build();
+ * SecuritySettings response = securitySettingsServiceClient.getSecuritySettings(request);
+ * }
+ *
+ */
+ public final UnaryCallable
+ * try (SecuritySettingsServiceClient securitySettingsServiceClient = SecuritySettingsServiceClient.create()) {
+ * SecuritySettingsName name = SecuritySettingsName.of("[PROJECT]", "[LOCATION]", "[SECURITY_SETTINGS]");
+ * GetSecuritySettingsRequest request = GetSecuritySettingsRequest.newBuilder()
+ * .setName(name.toString())
+ * .build();
+ * ApiFuture<SecuritySettings> future = securitySettingsServiceClient.getSecuritySettingsCallable().futureCall(request);
+ * // Do something
+ * SecuritySettings response = future.get();
+ * }
+ *
+ *
+ * @param securitySettings Required. [SecuritySettings] object that contains values for each of
+ * the fields to update.
+ * @param updateMask Required. The mask to control which fields get updated. If the mask is not
+ * present, all fields will be updated.
+ * @throws com.google.api.gax.rpc.ApiException if the remote call fails
+ */
+ public final SecuritySettings updateSecuritySettings(
+ SecuritySettings securitySettings, FieldMask updateMask) {
+ UpdateSecuritySettingsRequest request =
+ UpdateSecuritySettingsRequest.newBuilder()
+ .setSecuritySettings(securitySettings)
+ .setUpdateMask(updateMask)
+ .build();
+ return updateSecuritySettings(request);
+ }
+
+ // AUTO-GENERATED DOCUMENTATION AND METHOD
+ /**
+ * Updates the specified [SecuritySettings][google.cloud.dialogflow.cx.v3.SecuritySettings].
+ *
+ *
+ * try (SecuritySettingsServiceClient securitySettingsServiceClient = SecuritySettingsServiceClient.create()) {
+ * SecuritySettings securitySettings = SecuritySettings.newBuilder().build();
+ * FieldMask updateMask = FieldMask.newBuilder().build();
+ * SecuritySettings response = securitySettingsServiceClient.updateSecuritySettings(securitySettings, updateMask);
+ * }
+ *
+ *
+ * @param 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
+ */
+ public final SecuritySettings updateSecuritySettings(UpdateSecuritySettingsRequest request) {
+ return updateSecuritySettingsCallable().call(request);
+ }
+
+ // AUTO-GENERATED DOCUMENTATION AND METHOD
+ /**
+ * Updates the specified [SecuritySettings][google.cloud.dialogflow.cx.v3.SecuritySettings].
+ *
+ *
+ * try (SecuritySettingsServiceClient securitySettingsServiceClient = SecuritySettingsServiceClient.create()) {
+ * SecuritySettings securitySettings = SecuritySettings.newBuilder().build();
+ * FieldMask updateMask = FieldMask.newBuilder().build();
+ * UpdateSecuritySettingsRequest request = UpdateSecuritySettingsRequest.newBuilder()
+ * .setSecuritySettings(securitySettings)
+ * .setUpdateMask(updateMask)
+ * .build();
+ * SecuritySettings response = securitySettingsServiceClient.updateSecuritySettings(request);
+ * }
+ *
+ */
+ public final UnaryCallable
+ * try (SecuritySettingsServiceClient securitySettingsServiceClient = SecuritySettingsServiceClient.create()) {
+ * SecuritySettings securitySettings = SecuritySettings.newBuilder().build();
+ * FieldMask updateMask = FieldMask.newBuilder().build();
+ * UpdateSecuritySettingsRequest request = UpdateSecuritySettingsRequest.newBuilder()
+ * .setSecuritySettings(securitySettings)
+ * .setUpdateMask(updateMask)
+ * .build();
+ * ApiFuture<SecuritySettings> future = securitySettingsServiceClient.updateSecuritySettingsCallable().futureCall(request);
+ * // Do something
+ * SecuritySettings response = future.get();
+ * }
+ *
+ *
+ * @param parent Required. The location to list all security settings for. Format:
+ * `projects/<Project ID>/locations/<Location ID>`.
+ * @throws com.google.api.gax.rpc.ApiException if the remote call fails
+ */
+ public final ListSecuritySettingsPagedResponse listSecuritySettings(LocationName parent) {
+ ListSecuritySettingsRequest request =
+ ListSecuritySettingsRequest.newBuilder()
+ .setParent(parent == null ? null : parent.toString())
+ .build();
+ return listSecuritySettings(request);
+ }
+
+ // AUTO-GENERATED DOCUMENTATION AND METHOD
+ /**
+ * Returns the list of all security settings in the specified location.
+ *
+ *
+ * try (SecuritySettingsServiceClient securitySettingsServiceClient = SecuritySettingsServiceClient.create()) {
+ * LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]");
+ * for (SecuritySettings element : securitySettingsServiceClient.listSecuritySettings(parent).iterateAll()) {
+ * // doThingsWith(element);
+ * }
+ * }
+ *
+ *
+ * @param parent Required. The location to list all security settings for. Format:
+ * `projects/<Project ID>/locations/<Location ID>`.
+ * @throws com.google.api.gax.rpc.ApiException if the remote call fails
+ */
+ public final ListSecuritySettingsPagedResponse listSecuritySettings(String parent) {
+ ListSecuritySettingsRequest request =
+ ListSecuritySettingsRequest.newBuilder().setParent(parent).build();
+ return listSecuritySettings(request);
+ }
+
+ // AUTO-GENERATED DOCUMENTATION AND METHOD
+ /**
+ * Returns the list of all security settings in the specified location.
+ *
+ *
+ * try (SecuritySettingsServiceClient securitySettingsServiceClient = SecuritySettingsServiceClient.create()) {
+ * LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]");
+ * for (SecuritySettings element : securitySettingsServiceClient.listSecuritySettings(parent.toString()).iterateAll()) {
+ * // doThingsWith(element);
+ * }
+ * }
+ *
+ *
+ * @param 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
+ */
+ public final ListSecuritySettingsPagedResponse listSecuritySettings(
+ ListSecuritySettingsRequest request) {
+ return listSecuritySettingsPagedCallable().call(request);
+ }
+
+ // AUTO-GENERATED DOCUMENTATION AND METHOD
+ /**
+ * Returns the list of all security settings in the specified location.
+ *
+ *
+ * try (SecuritySettingsServiceClient securitySettingsServiceClient = SecuritySettingsServiceClient.create()) {
+ * LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]");
+ * ListSecuritySettingsRequest request = ListSecuritySettingsRequest.newBuilder()
+ * .setParent(parent.toString())
+ * .build();
+ * for (SecuritySettings element : securitySettingsServiceClient.listSecuritySettings(request).iterateAll()) {
+ * // doThingsWith(element);
+ * }
+ * }
+ *
+ */
+ public final UnaryCallable
+ * try (SecuritySettingsServiceClient securitySettingsServiceClient = SecuritySettingsServiceClient.create()) {
+ * LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]");
+ * ListSecuritySettingsRequest request = ListSecuritySettingsRequest.newBuilder()
+ * .setParent(parent.toString())
+ * .build();
+ * ApiFuture<ListSecuritySettingsPagedResponse> future = securitySettingsServiceClient.listSecuritySettingsPagedCallable().futureCall(request);
+ * // Do something
+ * for (SecuritySettings element : future.get().iterateAll()) {
+ * // doThingsWith(element);
+ * }
+ * }
+ *
+ */
+ public final UnaryCallable
+ * try (SecuritySettingsServiceClient securitySettingsServiceClient = SecuritySettingsServiceClient.create()) {
+ * LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]");
+ * ListSecuritySettingsRequest request = ListSecuritySettingsRequest.newBuilder()
+ * .setParent(parent.toString())
+ * .build();
+ * while (true) {
+ * ListSecuritySettingsResponse response = securitySettingsServiceClient.listSecuritySettingsCallable().call(request);
+ * for (SecuritySettings element : response.getSecuritySettingsList()) {
+ * // doThingsWith(element);
+ * }
+ * String nextPageToken = response.getNextPageToken();
+ * if (!Strings.isNullOrEmpty(nextPageToken)) {
+ * request = request.toBuilder().setPageToken(nextPageToken).build();
+ * } else {
+ * break;
+ * }
+ * }
+ * }
+ *
+ *
+ * @param name Required. The name of the
+ * [SecuritySettings][google.cloud.dialogflow.cx.v3.SecuritySettings] to delete. Format:
+ * `projects/<Project ID>/locations/<Location ID>/securitySettings/<Security
+ * Settings ID>`.
+ * @throws com.google.api.gax.rpc.ApiException if the remote call fails
+ */
+ public final void deleteSecuritySettings(SecuritySettingsName name) {
+ DeleteSecuritySettingsRequest request =
+ DeleteSecuritySettingsRequest.newBuilder()
+ .setName(name == null ? null : name.toString())
+ .build();
+ deleteSecuritySettings(request);
+ }
+
+ // AUTO-GENERATED DOCUMENTATION AND METHOD
+ /**
+ * Deletes the specified [SecuritySettings][google.cloud.dialogflow.cx.v3.SecuritySettings].
+ *
+ *
+ * try (SecuritySettingsServiceClient securitySettingsServiceClient = SecuritySettingsServiceClient.create()) {
+ * SecuritySettingsName name = SecuritySettingsName.of("[PROJECT]", "[LOCATION]", "[SECURITY_SETTINGS]");
+ * securitySettingsServiceClient.deleteSecuritySettings(name);
+ * }
+ *
+ *
+ * @param name Required. The name of the
+ * [SecuritySettings][google.cloud.dialogflow.cx.v3.SecuritySettings] to delete. Format:
+ * `projects/<Project ID>/locations/<Location ID>/securitySettings/<Security
+ * Settings ID>`.
+ * @throws com.google.api.gax.rpc.ApiException if the remote call fails
+ */
+ public final void deleteSecuritySettings(String name) {
+ DeleteSecuritySettingsRequest request =
+ DeleteSecuritySettingsRequest.newBuilder().setName(name).build();
+ deleteSecuritySettings(request);
+ }
+
+ // AUTO-GENERATED DOCUMENTATION AND METHOD
+ /**
+ * Deletes the specified [SecuritySettings][google.cloud.dialogflow.cx.v3.SecuritySettings].
+ *
+ *
+ * try (SecuritySettingsServiceClient securitySettingsServiceClient = SecuritySettingsServiceClient.create()) {
+ * SecuritySettingsName name = SecuritySettingsName.of("[PROJECT]", "[LOCATION]", "[SECURITY_SETTINGS]");
+ * securitySettingsServiceClient.deleteSecuritySettings(name.toString());
+ * }
+ *
+ *
+ * @param 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
+ */
+ public final void deleteSecuritySettings(DeleteSecuritySettingsRequest request) {
+ deleteSecuritySettingsCallable().call(request);
+ }
+
+ // AUTO-GENERATED DOCUMENTATION AND METHOD
+ /**
+ * Deletes the specified [SecuritySettings][google.cloud.dialogflow.cx.v3.SecuritySettings].
+ *
+ *
+ * try (SecuritySettingsServiceClient securitySettingsServiceClient = SecuritySettingsServiceClient.create()) {
+ * SecuritySettingsName name = SecuritySettingsName.of("[PROJECT]", "[LOCATION]", "[SECURITY_SETTINGS]");
+ * DeleteSecuritySettingsRequest request = DeleteSecuritySettingsRequest.newBuilder()
+ * .setName(name.toString())
+ * .build();
+ * securitySettingsServiceClient.deleteSecuritySettings(request);
+ * }
+ *
+ */
+ public final UnaryCallable
+ * try (SecuritySettingsServiceClient securitySettingsServiceClient = SecuritySettingsServiceClient.create()) {
+ * SecuritySettingsName name = SecuritySettingsName.of("[PROJECT]", "[LOCATION]", "[SECURITY_SETTINGS]");
+ * DeleteSecuritySettingsRequest request = DeleteSecuritySettingsRequest.newBuilder()
+ * .setName(name.toString())
+ * .build();
+ * ApiFuture<Void> future = securitySettingsServiceClient.deleteSecuritySettingsCallable().futureCall(request);
+ * // Do something
+ * future.get();
+ * }
+ *