@BetaApi @Generated(value="by gapic-generator-java") public class ToolsClient extends Object implements com.google.api.gax.core.BackgroundResource
This class provides the ability to make remote calls to the backing service through method calls that map to API methods. Sample code to get started:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (ToolsClient toolsClient = ToolsClient.create()) {
AgentName parent = AgentName.of("[PROJECT]", "[LOCATION]", "[AGENT]");
Tool tool = Tool.newBuilder().build();
Tool response = toolsClient.createTool(parent, tool);
}
Note: close() needs to be called on the ToolsClient object to clean up resources such as threads. In the example above, try-with-resources is used, which automatically calls close().
| Method | Description | Method Variants |
|---|---|---|
CreateTool |
Creates a [Tool][google.cloud.dialogflow.cx.v3beta1.Tool] in the specified agent. |
Request object method variants only take one parameter, a request object, which must be constructed before the call.
"Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method.
Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.
|
ListTools |
Returns a list of [Tools][google.cloud.dialogflow.cx.v3beta1.Tool] in the specified agent. |
Request object method variants only take one parameter, a request object, which must be constructed before the call.
"Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method.
Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.
|
ExportTools |
Exports the selected tools. |
Request object method variants only take one parameter, a request object, which must be constructed before the call.
Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.
|
GetTool |
Retrieves the specified [Tool][google.cloud.dialogflow.cx.v3beta1.Tool]. |
Request object method variants only take one parameter, a request object, which must be constructed before the call.
"Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method.
Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.
|
UpdateTool |
Update the specified [Tool][google.cloud.dialogflow.cx.v3beta1.Tool]. |
Request object method variants only take one parameter, a request object, which must be constructed before the call.
"Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method.
Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.
|
DeleteTool |
Deletes a specified [Tool][google.cloud.dialogflow.cx.v3beta1.Tool]. |
Request object method variants only take one parameter, a request object, which must be constructed before the call.
"Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method.
Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.
|
ListToolVersions |
List versions of the specified [Tool][google.cloud.dialogflow.cx.v3beta1.Tool]. |
Request object method variants only take one parameter, a request object, which must be constructed before the call.
"Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method.
Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.
|
CreateToolVersion |
Creates a version for the specified [Tool][google.cloud.dialogflow.cx.v3beta1.Tool]. |
Request object method variants only take one parameter, a request object, which must be constructed before the call.
"Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method.
Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.
|
GetToolVersion |
Retrieves the specified version of the [Tool][google.cloud.dialogflow.cx.v3beta1.Tool]. |
Request object method variants only take one parameter, a request object, which must be constructed before the call.
"Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method.
Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.
|
DeleteToolVersion |
Deletes the specified version of the [Tool][google.cloud.dialogflow.cx.v3beta1.Tool]. |
Request object method variants only take one parameter, a request object, which must be constructed before the call.
"Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method.
Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.
|
RestoreToolVersion |
Retrieves the specified version of the Tool and stores it as the current tool draft, returning the tool with resources updated. |
Request object method variants only take one parameter, a request object, which must be constructed before the call.
"Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method.
Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.
|
ListLocations |
Lists information about the supported locations for this service. |
Request object method variants only take one parameter, a request object, which must be constructed before the call.
Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.
|
GetLocation |
Gets information about a location. |
Request object method variants only take one parameter, a request object, which must be constructed before the call.
Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.
|
See the individual methods for example code.
Many parameters require resource names to be formatted in a particular way. To assist with these names, this class includes a format method for each type of name, and additionally a parse method to extract the individual identifiers contained within names that are returned.
This class can be customized by passing in a custom instance of ToolsSettings to create(). For example:
To customize credentials:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
ToolsSettings toolsSettings =
ToolsSettings.newBuilder()
.setCredentialsProvider(FixedCredentialsProvider.create(myCredentials))
.build();
ToolsClient toolsClient = ToolsClient.create(toolsSettings);
To customize the endpoint:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
ToolsSettings toolsSettings = ToolsSettings.newBuilder().setEndpoint(myEndpoint).build();
ToolsClient toolsClient = ToolsClient.create(toolsSettings);
To use REST (HTTP1.1/JSON) transport (instead of gRPC) for sending and receiving requests over the wire:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
ToolsSettings toolsSettings = ToolsSettings.newHttpJsonBuilder().build();
ToolsClient toolsClient = ToolsClient.create(toolsSettings);
Please refer to the GitHub repository's samples for more quickstart code snippets.
| Modifier and Type | Class and Description |
|---|---|
static class |
ToolsClient.ListLocationsFixedSizeCollection |
static class |
ToolsClient.ListLocationsPage |
static class |
ToolsClient.ListLocationsPagedResponse |
static class |
ToolsClient.ListToolsFixedSizeCollection |
static class |
ToolsClient.ListToolsPage |
static class |
ToolsClient.ListToolsPagedResponse |
static class |
ToolsClient.ListToolVersionsFixedSizeCollection |
static class |
ToolsClient.ListToolVersionsPage |
static class |
ToolsClient.ListToolVersionsPagedResponse |
| Modifier | Constructor and Description |
|---|---|
protected |
ToolsClient(ToolsSettings settings)
Constructs an instance of ToolsClient, using the given settings.
|
protected |
ToolsClient(ToolsStub stub) |
| Modifier and Type | Method and Description |
|---|---|
boolean |
awaitTermination(long duration,
TimeUnit unit) |
void |
close() |
static ToolsClient |
create()
Constructs an instance of ToolsClient with default settings.
|
static ToolsClient |
create(ToolsSettings settings)
Constructs an instance of ToolsClient, using the given settings.
|
static ToolsClient |
create(ToolsStub stub)
Constructs an instance of ToolsClient, using the given stub for making calls.
|
Tool |
createTool(AgentName parent,
Tool tool)
Creates a [Tool][google.cloud.dialogflow.cx.v3beta1.Tool] in the specified agent.
|
Tool |
createTool(CreateToolRequest request)
Creates a [Tool][google.cloud.dialogflow.cx.v3beta1.Tool] in the specified agent.
|
Tool |
createTool(String parent,
Tool tool)
Creates a [Tool][google.cloud.dialogflow.cx.v3beta1.Tool] in the specified agent.
|
com.google.api.gax.rpc.UnaryCallable<CreateToolRequest,Tool> |
createToolCallable()
Creates a [Tool][google.cloud.dialogflow.cx.v3beta1.Tool] in the specified agent.
|
ToolVersion |
createToolVersion(CreateToolVersionRequest request)
Creates a version for the specified [Tool][google.cloud.dialogflow.cx.v3beta1.Tool].
|
ToolVersion |
createToolVersion(String parent,
ToolVersion toolVersion)
Creates a version for the specified [Tool][google.cloud.dialogflow.cx.v3beta1.Tool].
|
ToolVersion |
createToolVersion(ToolName parent,
ToolVersion toolVersion)
Creates a version for the specified [Tool][google.cloud.dialogflow.cx.v3beta1.Tool].
|
com.google.api.gax.rpc.UnaryCallable<CreateToolVersionRequest,ToolVersion> |
createToolVersionCallable()
Creates a version for the specified [Tool][google.cloud.dialogflow.cx.v3beta1.Tool].
|
void |
deleteTool(DeleteToolRequest request)
Deletes a specified [Tool][google.cloud.dialogflow.cx.v3beta1.Tool].
|
void |
deleteTool(String name)
Deletes a specified [Tool][google.cloud.dialogflow.cx.v3beta1.Tool].
|
void |
deleteTool(ToolName name)
Deletes a specified [Tool][google.cloud.dialogflow.cx.v3beta1.Tool].
|
com.google.api.gax.rpc.UnaryCallable<DeleteToolRequest,com.google.protobuf.Empty> |
deleteToolCallable()
Deletes a specified [Tool][google.cloud.dialogflow.cx.v3beta1.Tool].
|
void |
deleteToolVersion(DeleteToolVersionRequest request)
Deletes the specified version of the [Tool][google.cloud.dialogflow.cx.v3beta1.Tool].
|
void |
deleteToolVersion(String name)
Deletes the specified version of the [Tool][google.cloud.dialogflow.cx.v3beta1.Tool].
|
void |
deleteToolVersion(ToolVersionName name)
Deletes the specified version of the [Tool][google.cloud.dialogflow.cx.v3beta1.Tool].
|
com.google.api.gax.rpc.UnaryCallable<DeleteToolVersionRequest,com.google.protobuf.Empty> |
deleteToolVersionCallable()
Deletes the specified version of the [Tool][google.cloud.dialogflow.cx.v3beta1.Tool].
|
com.google.api.gax.longrunning.OperationFuture<ExportToolsResponse,ExportToolsMetadata> |
exportToolsAsync(ExportToolsRequest request)
Exports the selected tools.
|
com.google.api.gax.rpc.UnaryCallable<ExportToolsRequest,com.google.longrunning.Operation> |
exportToolsCallable()
Exports the selected tools.
|
com.google.api.gax.rpc.OperationCallable<ExportToolsRequest,ExportToolsResponse,ExportToolsMetadata> |
exportToolsOperationCallable()
Exports the selected tools.
|
com.google.api.gax.httpjson.longrunning.OperationsClient |
getHttpJsonOperationsClient()
Returns the OperationsClient that can be used to query the status of a long-running operation
returned by another API method call.
|
com.google.cloud.location.Location |
getLocation(com.google.cloud.location.GetLocationRequest request)
Gets information about a location.
|
com.google.api.gax.rpc.UnaryCallable<com.google.cloud.location.GetLocationRequest,com.google.cloud.location.Location> |
getLocationCallable()
Gets information about a location.
|
com.google.longrunning.OperationsClient |
getOperationsClient()
Returns the OperationsClient that can be used to query the status of a long-running operation
returned by another API method call.
|
ToolsSettings |
getSettings() |
ToolsStub |
getStub() |
Tool |
getTool(GetToolRequest request)
Retrieves the specified [Tool][google.cloud.dialogflow.cx.v3beta1.Tool].
|
Tool |
getTool(String name)
Retrieves the specified [Tool][google.cloud.dialogflow.cx.v3beta1.Tool].
|
Tool |
getTool(ToolName name)
Retrieves the specified [Tool][google.cloud.dialogflow.cx.v3beta1.Tool].
|
com.google.api.gax.rpc.UnaryCallable<GetToolRequest,Tool> |
getToolCallable()
Retrieves the specified [Tool][google.cloud.dialogflow.cx.v3beta1.Tool].
|
ToolVersion |
getToolVersion(GetToolVersionRequest request)
Retrieves the specified version of the [Tool][google.cloud.dialogflow.cx.v3beta1.Tool].
|
ToolVersion |
getToolVersion(String name)
Retrieves the specified version of the [Tool][google.cloud.dialogflow.cx.v3beta1.Tool].
|
ToolVersion |
getToolVersion(ToolVersionName name)
Retrieves the specified version of the [Tool][google.cloud.dialogflow.cx.v3beta1.Tool].
|
com.google.api.gax.rpc.UnaryCallable<GetToolVersionRequest,ToolVersion> |
getToolVersionCallable()
Retrieves the specified version of the [Tool][google.cloud.dialogflow.cx.v3beta1.Tool].
|
boolean |
isShutdown() |
boolean |
isTerminated() |
ToolsClient.ListLocationsPagedResponse |
listLocations(com.google.cloud.location.ListLocationsRequest request)
Lists information about the supported locations for this service.
|
com.google.api.gax.rpc.UnaryCallable<com.google.cloud.location.ListLocationsRequest,com.google.cloud.location.ListLocationsResponse> |
listLocationsCallable()
Lists information about the supported locations for this service.
|
com.google.api.gax.rpc.UnaryCallable<com.google.cloud.location.ListLocationsRequest,ToolsClient.ListLocationsPagedResponse> |
listLocationsPagedCallable()
Lists information about the supported locations for this service.
|
ToolsClient.ListToolsPagedResponse |
listTools(AgentName parent)
Returns a list of [Tools][google.cloud.dialogflow.cx.v3beta1.Tool] in the specified agent.
|
ToolsClient.ListToolsPagedResponse |
listTools(ListToolsRequest request)
Returns a list of [Tools][google.cloud.dialogflow.cx.v3beta1.Tool] in the specified agent.
|
ToolsClient.ListToolsPagedResponse |
listTools(String parent)
Returns a list of [Tools][google.cloud.dialogflow.cx.v3beta1.Tool] in the specified agent.
|
com.google.api.gax.rpc.UnaryCallable<ListToolsRequest,ListToolsResponse> |
listToolsCallable()
Returns a list of [Tools][google.cloud.dialogflow.cx.v3beta1.Tool] in the specified agent.
|
com.google.api.gax.rpc.UnaryCallable<ListToolsRequest,ToolsClient.ListToolsPagedResponse> |
listToolsPagedCallable()
Returns a list of [Tools][google.cloud.dialogflow.cx.v3beta1.Tool] in the specified agent.
|
ToolsClient.ListToolVersionsPagedResponse |
listToolVersions(ListToolVersionsRequest request)
List versions of the specified [Tool][google.cloud.dialogflow.cx.v3beta1.Tool].
|
ToolsClient.ListToolVersionsPagedResponse |
listToolVersions(String parent)
List versions of the specified [Tool][google.cloud.dialogflow.cx.v3beta1.Tool].
|
ToolsClient.ListToolVersionsPagedResponse |
listToolVersions(ToolName parent)
List versions of the specified [Tool][google.cloud.dialogflow.cx.v3beta1.Tool].
|
com.google.api.gax.rpc.UnaryCallable<ListToolVersionsRequest,ListToolVersionsResponse> |
listToolVersionsCallable()
List versions of the specified [Tool][google.cloud.dialogflow.cx.v3beta1.Tool].
|
com.google.api.gax.rpc.UnaryCallable<ListToolVersionsRequest,ToolsClient.ListToolVersionsPagedResponse> |
listToolVersionsPagedCallable()
List versions of the specified [Tool][google.cloud.dialogflow.cx.v3beta1.Tool].
|
RestoreToolVersionResponse |
restoreToolVersion(RestoreToolVersionRequest request)
Retrieves the specified version of the Tool and stores it as the current tool draft, returning
the tool with resources updated.
|
RestoreToolVersionResponse |
restoreToolVersion(String name)
Retrieves the specified version of the Tool and stores it as the current tool draft, returning
the tool with resources updated.
|
RestoreToolVersionResponse |
restoreToolVersion(ToolVersionName name)
Retrieves the specified version of the Tool and stores it as the current tool draft, returning
the tool with resources updated.
|
com.google.api.gax.rpc.UnaryCallable<RestoreToolVersionRequest,RestoreToolVersionResponse> |
restoreToolVersionCallable()
Retrieves the specified version of the Tool and stores it as the current tool draft, returning
the tool with resources updated.
|
void |
shutdown() |
void |
shutdownNow() |
Tool |
updateTool(Tool tool,
com.google.protobuf.FieldMask updateMask)
Update the specified [Tool][google.cloud.dialogflow.cx.v3beta1.Tool].
|
Tool |
updateTool(UpdateToolRequest request)
Update the specified [Tool][google.cloud.dialogflow.cx.v3beta1.Tool].
|
com.google.api.gax.rpc.UnaryCallable<UpdateToolRequest,Tool> |
updateToolCallable()
Update the specified [Tool][google.cloud.dialogflow.cx.v3beta1.Tool].
|
protected ToolsClient(ToolsSettings settings) throws IOException
IOExceptionprotected ToolsClient(ToolsStub stub)
public static final ToolsClient create() throws IOException
IOExceptionpublic static final ToolsClient create(ToolsSettings settings) throws IOException
IOExceptionpublic static final ToolsClient create(ToolsStub stub)
public final ToolsSettings getSettings()
public ToolsStub getStub()
public final com.google.longrunning.OperationsClient getOperationsClient()
@BetaApi public final com.google.api.gax.httpjson.longrunning.OperationsClient getHttpJsonOperationsClient()
public final Tool createTool(AgentName parent, Tool tool)
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (ToolsClient toolsClient = ToolsClient.create()) {
AgentName parent = AgentName.of("[PROJECT]", "[LOCATION]", "[AGENT]");
Tool tool = Tool.newBuilder().build();
Tool response = toolsClient.createTool(parent, tool);
}
parent - Required. The agent to create a Tool for. Format:
`projects/<ProjectID>/locations/<LocationID>/agents/<AgentID>`.tool - Required. The Tool to be created.com.google.api.gax.rpc.ApiException - if the remote call failspublic final Tool createTool(String parent, Tool tool)
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (ToolsClient toolsClient = ToolsClient.create()) {
String parent = AgentName.of("[PROJECT]", "[LOCATION]", "[AGENT]").toString();
Tool tool = Tool.newBuilder().build();
Tool response = toolsClient.createTool(parent, tool);
}
parent - Required. The agent to create a Tool for. Format:
`projects/<ProjectID>/locations/<LocationID>/agents/<AgentID>`.tool - Required. The Tool to be created.com.google.api.gax.rpc.ApiException - if the remote call failspublic final Tool createTool(CreateToolRequest request)
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (ToolsClient toolsClient = ToolsClient.create()) {
CreateToolRequest request =
CreateToolRequest.newBuilder()
.setParent(AgentName.of("[PROJECT]", "[LOCATION]", "[AGENT]").toString())
.setTool(Tool.newBuilder().build())
.build();
Tool response = toolsClient.createTool(request);
}
request - The request object containing all of the parameters for the API call.com.google.api.gax.rpc.ApiException - if the remote call failspublic final com.google.api.gax.rpc.UnaryCallable<CreateToolRequest,Tool> createToolCallable()
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (ToolsClient toolsClient = ToolsClient.create()) {
CreateToolRequest request =
CreateToolRequest.newBuilder()
.setParent(AgentName.of("[PROJECT]", "[LOCATION]", "[AGENT]").toString())
.setTool(Tool.newBuilder().build())
.build();
ApiFuture<Tool> future = toolsClient.createToolCallable().futureCall(request);
// Do something.
Tool response = future.get();
}
public final ToolsClient.ListToolsPagedResponse listTools(AgentName parent)
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (ToolsClient toolsClient = ToolsClient.create()) {
AgentName parent = AgentName.of("[PROJECT]", "[LOCATION]", "[AGENT]");
for (Tool element : toolsClient.listTools(parent).iterateAll()) {
// doThingsWith(element);
}
}
parent - Required. The agent to list the Tools from. Format:
`projects/<ProjectID>/locations/<LocationID>/agents/<AgentID>`.com.google.api.gax.rpc.ApiException - if the remote call failspublic final ToolsClient.ListToolsPagedResponse listTools(String parent)
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (ToolsClient toolsClient = ToolsClient.create()) {
String parent = AgentName.of("[PROJECT]", "[LOCATION]", "[AGENT]").toString();
for (Tool element : toolsClient.listTools(parent).iterateAll()) {
// doThingsWith(element);
}
}
parent - Required. The agent to list the Tools from. Format:
`projects/<ProjectID>/locations/<LocationID>/agents/<AgentID>`.com.google.api.gax.rpc.ApiException - if the remote call failspublic final ToolsClient.ListToolsPagedResponse listTools(ListToolsRequest request)
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (ToolsClient toolsClient = ToolsClient.create()) {
ListToolsRequest request =
ListToolsRequest.newBuilder()
.setParent(AgentName.of("[PROJECT]", "[LOCATION]", "[AGENT]").toString())
.setPageSize(883849137)
.setPageToken("pageToken873572522")
.build();
for (Tool element : toolsClient.listTools(request).iterateAll()) {
// doThingsWith(element);
}
}
request - The request object containing all of the parameters for the API call.com.google.api.gax.rpc.ApiException - if the remote call failspublic final com.google.api.gax.rpc.UnaryCallable<ListToolsRequest,ToolsClient.ListToolsPagedResponse> listToolsPagedCallable()
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (ToolsClient toolsClient = ToolsClient.create()) {
ListToolsRequest request =
ListToolsRequest.newBuilder()
.setParent(AgentName.of("[PROJECT]", "[LOCATION]", "[AGENT]").toString())
.setPageSize(883849137)
.setPageToken("pageToken873572522")
.build();
ApiFuture<Tool> future = toolsClient.listToolsPagedCallable().futureCall(request);
// Do something.
for (Tool element : future.get().iterateAll()) {
// doThingsWith(element);
}
}
public final com.google.api.gax.rpc.UnaryCallable<ListToolsRequest,ListToolsResponse> listToolsCallable()
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (ToolsClient toolsClient = ToolsClient.create()) {
ListToolsRequest request =
ListToolsRequest.newBuilder()
.setParent(AgentName.of("[PROJECT]", "[LOCATION]", "[AGENT]").toString())
.setPageSize(883849137)
.setPageToken("pageToken873572522")
.build();
while (true) {
ListToolsResponse response = toolsClient.listToolsCallable().call(request);
for (Tool element : response.getToolsList()) {
// doThingsWith(element);
}
String nextPageToken = response.getNextPageToken();
if (!Strings.isNullOrEmpty(nextPageToken)) {
request = request.toBuilder().setPageToken(nextPageToken).build();
} else {
break;
}
}
}
public final com.google.api.gax.longrunning.OperationFuture<ExportToolsResponse,ExportToolsMetadata> exportToolsAsync(ExportToolsRequest request)
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (ToolsClient toolsClient = ToolsClient.create()) {
ExportToolsRequest request =
ExportToolsRequest.newBuilder()
.setParent(AgentName.of("[PROJECT]", "[LOCATION]", "[AGENT]").toString())
.addAllTools(new ArrayList<String>())
.build();
ExportToolsResponse response = toolsClient.exportToolsAsync(request).get();
}
request - The request object containing all of the parameters for the API call.com.google.api.gax.rpc.ApiException - if the remote call failspublic final com.google.api.gax.rpc.OperationCallable<ExportToolsRequest,ExportToolsResponse,ExportToolsMetadata> exportToolsOperationCallable()
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (ToolsClient toolsClient = ToolsClient.create()) {
ExportToolsRequest request =
ExportToolsRequest.newBuilder()
.setParent(AgentName.of("[PROJECT]", "[LOCATION]", "[AGENT]").toString())
.addAllTools(new ArrayList<String>())
.build();
OperationFuture<ExportToolsResponse, ExportToolsMetadata> future =
toolsClient.exportToolsOperationCallable().futureCall(request);
// Do something.
ExportToolsResponse response = future.get();
}
public final com.google.api.gax.rpc.UnaryCallable<ExportToolsRequest,com.google.longrunning.Operation> exportToolsCallable()
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (ToolsClient toolsClient = ToolsClient.create()) {
ExportToolsRequest request =
ExportToolsRequest.newBuilder()
.setParent(AgentName.of("[PROJECT]", "[LOCATION]", "[AGENT]").toString())
.addAllTools(new ArrayList<String>())
.build();
ApiFuture<Operation> future = toolsClient.exportToolsCallable().futureCall(request);
// Do something.
Operation response = future.get();
}
public final Tool getTool(ToolName name)
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (ToolsClient toolsClient = ToolsClient.create()) {
ToolName name = ToolName.of("[PROJECT]", "[LOCATION]", "[AGENT]", "[TOOL]");
Tool response = toolsClient.getTool(name);
}
name - Required. The name of the Tool. Format:
`projects/<ProjectID>/locations/<LocationID>/agents/<AgentID>/tools/<ToolID>`.com.google.api.gax.rpc.ApiException - if the remote call failspublic final Tool getTool(String name)
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (ToolsClient toolsClient = ToolsClient.create()) {
String name = ToolName.of("[PROJECT]", "[LOCATION]", "[AGENT]", "[TOOL]").toString();
Tool response = toolsClient.getTool(name);
}
name - Required. The name of the Tool. Format:
`projects/<ProjectID>/locations/<LocationID>/agents/<AgentID>/tools/<ToolID>`.com.google.api.gax.rpc.ApiException - if the remote call failspublic final Tool getTool(GetToolRequest request)
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (ToolsClient toolsClient = ToolsClient.create()) {
GetToolRequest request =
GetToolRequest.newBuilder()
.setName(ToolName.of("[PROJECT]", "[LOCATION]", "[AGENT]", "[TOOL]").toString())
.build();
Tool response = toolsClient.getTool(request);
}
request - The request object containing all of the parameters for the API call.com.google.api.gax.rpc.ApiException - if the remote call failspublic final com.google.api.gax.rpc.UnaryCallable<GetToolRequest,Tool> getToolCallable()
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (ToolsClient toolsClient = ToolsClient.create()) {
GetToolRequest request =
GetToolRequest.newBuilder()
.setName(ToolName.of("[PROJECT]", "[LOCATION]", "[AGENT]", "[TOOL]").toString())
.build();
ApiFuture<Tool> future = toolsClient.getToolCallable().futureCall(request);
// Do something.
Tool response = future.get();
}
public final Tool updateTool(Tool tool, com.google.protobuf.FieldMask updateMask)
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (ToolsClient toolsClient = ToolsClient.create()) {
Tool tool = Tool.newBuilder().build();
FieldMask updateMask = FieldMask.newBuilder().build();
Tool response = toolsClient.updateTool(tool, updateMask);
}
tool - Required. The Tool to be updated.updateMask - The mask to control which fields get updated. If the mask is not present, all
fields will be updated.com.google.api.gax.rpc.ApiException - if the remote call failspublic final Tool updateTool(UpdateToolRequest request)
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (ToolsClient toolsClient = ToolsClient.create()) {
UpdateToolRequest request =
UpdateToolRequest.newBuilder()
.setTool(Tool.newBuilder().build())
.setUpdateMask(FieldMask.newBuilder().build())
.build();
Tool response = toolsClient.updateTool(request);
}
request - The request object containing all of the parameters for the API call.com.google.api.gax.rpc.ApiException - if the remote call failspublic final com.google.api.gax.rpc.UnaryCallable<UpdateToolRequest,Tool> updateToolCallable()
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (ToolsClient toolsClient = ToolsClient.create()) {
UpdateToolRequest request =
UpdateToolRequest.newBuilder()
.setTool(Tool.newBuilder().build())
.setUpdateMask(FieldMask.newBuilder().build())
.build();
ApiFuture<Tool> future = toolsClient.updateToolCallable().futureCall(request);
// Do something.
Tool response = future.get();
}
public final void deleteTool(ToolName name)
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (ToolsClient toolsClient = ToolsClient.create()) {
ToolName name = ToolName.of("[PROJECT]", "[LOCATION]", "[AGENT]", "[TOOL]");
toolsClient.deleteTool(name);
}
name - Required. The name of the Tool to be deleted. Format:
`projects/<ProjectID>/locations/<LocationID>/agents/<AgentID>/tools/<ToolID>`.com.google.api.gax.rpc.ApiException - if the remote call failspublic final void deleteTool(String name)
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (ToolsClient toolsClient = ToolsClient.create()) {
String name = ToolName.of("[PROJECT]", "[LOCATION]", "[AGENT]", "[TOOL]").toString();
toolsClient.deleteTool(name);
}
name - Required. The name of the Tool to be deleted. Format:
`projects/<ProjectID>/locations/<LocationID>/agents/<AgentID>/tools/<ToolID>`.com.google.api.gax.rpc.ApiException - if the remote call failspublic final void deleteTool(DeleteToolRequest request)
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (ToolsClient toolsClient = ToolsClient.create()) {
DeleteToolRequest request =
DeleteToolRequest.newBuilder()
.setName(ToolName.of("[PROJECT]", "[LOCATION]", "[AGENT]", "[TOOL]").toString())
.setForce(true)
.build();
toolsClient.deleteTool(request);
}
request - The request object containing all of the parameters for the API call.com.google.api.gax.rpc.ApiException - if the remote call failspublic final com.google.api.gax.rpc.UnaryCallable<DeleteToolRequest,com.google.protobuf.Empty> deleteToolCallable()
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (ToolsClient toolsClient = ToolsClient.create()) {
DeleteToolRequest request =
DeleteToolRequest.newBuilder()
.setName(ToolName.of("[PROJECT]", "[LOCATION]", "[AGENT]", "[TOOL]").toString())
.setForce(true)
.build();
ApiFuture<Empty> future = toolsClient.deleteToolCallable().futureCall(request);
// Do something.
future.get();
}
public final ToolsClient.ListToolVersionsPagedResponse listToolVersions(ToolName parent)
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (ToolsClient toolsClient = ToolsClient.create()) {
ToolName parent = ToolName.of("[PROJECT]", "[LOCATION]", "[AGENT]", "[TOOL]");
for (ToolVersion element : toolsClient.listToolVersions(parent).iterateAll()) {
// doThingsWith(element);
}
}
parent - Required. The parent of the tool versions. Format:
`projects/<ProjectID>/locations/<LocationID>/agents/<AgentID>/tools/<ToolID>`.com.google.api.gax.rpc.ApiException - if the remote call failspublic final ToolsClient.ListToolVersionsPagedResponse listToolVersions(String parent)
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (ToolsClient toolsClient = ToolsClient.create()) {
String parent = ToolName.of("[PROJECT]", "[LOCATION]", "[AGENT]", "[TOOL]").toString();
for (ToolVersion element : toolsClient.listToolVersions(parent).iterateAll()) {
// doThingsWith(element);
}
}
parent - Required. The parent of the tool versions. Format:
`projects/<ProjectID>/locations/<LocationID>/agents/<AgentID>/tools/<ToolID>`.com.google.api.gax.rpc.ApiException - if the remote call failspublic final ToolsClient.ListToolVersionsPagedResponse listToolVersions(ListToolVersionsRequest request)
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (ToolsClient toolsClient = ToolsClient.create()) {
ListToolVersionsRequest request =
ListToolVersionsRequest.newBuilder()
.setParent(ToolName.of("[PROJECT]", "[LOCATION]", "[AGENT]", "[TOOL]").toString())
.setPageSize(883849137)
.setPageToken("pageToken873572522")
.build();
for (ToolVersion element : toolsClient.listToolVersions(request).iterateAll()) {
// doThingsWith(element);
}
}
request - The request object containing all of the parameters for the API call.com.google.api.gax.rpc.ApiException - if the remote call failspublic final com.google.api.gax.rpc.UnaryCallable<ListToolVersionsRequest,ToolsClient.ListToolVersionsPagedResponse> listToolVersionsPagedCallable()
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (ToolsClient toolsClient = ToolsClient.create()) {
ListToolVersionsRequest request =
ListToolVersionsRequest.newBuilder()
.setParent(ToolName.of("[PROJECT]", "[LOCATION]", "[AGENT]", "[TOOL]").toString())
.setPageSize(883849137)
.setPageToken("pageToken873572522")
.build();
ApiFuture<ToolVersion> future =
toolsClient.listToolVersionsPagedCallable().futureCall(request);
// Do something.
for (ToolVersion element : future.get().iterateAll()) {
// doThingsWith(element);
}
}
public final com.google.api.gax.rpc.UnaryCallable<ListToolVersionsRequest,ListToolVersionsResponse> listToolVersionsCallable()
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (ToolsClient toolsClient = ToolsClient.create()) {
ListToolVersionsRequest request =
ListToolVersionsRequest.newBuilder()
.setParent(ToolName.of("[PROJECT]", "[LOCATION]", "[AGENT]", "[TOOL]").toString())
.setPageSize(883849137)
.setPageToken("pageToken873572522")
.build();
while (true) {
ListToolVersionsResponse response = toolsClient.listToolVersionsCallable().call(request);
for (ToolVersion element : response.getToolVersionsList()) {
// doThingsWith(element);
}
String nextPageToken = response.getNextPageToken();
if (!Strings.isNullOrEmpty(nextPageToken)) {
request = request.toBuilder().setPageToken(nextPageToken).build();
} else {
break;
}
}
}
public final ToolVersion createToolVersion(ToolName parent, ToolVersion toolVersion)
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (ToolsClient toolsClient = ToolsClient.create()) {
ToolName parent = ToolName.of("[PROJECT]", "[LOCATION]", "[AGENT]", "[TOOL]");
ToolVersion toolVersion = ToolVersion.newBuilder().build();
ToolVersion response = toolsClient.createToolVersion(parent, toolVersion);
}
parent - Required. The tool to create a version for. Format:
`projects/<ProjectID>/locations/<LocationID>/agents/<AgentID>/tools/<ToolID>`.toolVersion - Required. The tool version to create.com.google.api.gax.rpc.ApiException - if the remote call failspublic final ToolVersion createToolVersion(String parent, ToolVersion toolVersion)
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (ToolsClient toolsClient = ToolsClient.create()) {
String parent = ToolName.of("[PROJECT]", "[LOCATION]", "[AGENT]", "[TOOL]").toString();
ToolVersion toolVersion = ToolVersion.newBuilder().build();
ToolVersion response = toolsClient.createToolVersion(parent, toolVersion);
}
parent - Required. The tool to create a version for. Format:
`projects/<ProjectID>/locations/<LocationID>/agents/<AgentID>/tools/<ToolID>`.toolVersion - Required. The tool version to create.com.google.api.gax.rpc.ApiException - if the remote call failspublic final ToolVersion createToolVersion(CreateToolVersionRequest request)
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (ToolsClient toolsClient = ToolsClient.create()) {
CreateToolVersionRequest request =
CreateToolVersionRequest.newBuilder()
.setParent(ToolName.of("[PROJECT]", "[LOCATION]", "[AGENT]", "[TOOL]").toString())
.setToolVersion(ToolVersion.newBuilder().build())
.build();
ToolVersion response = toolsClient.createToolVersion(request);
}
request - The request object containing all of the parameters for the API call.com.google.api.gax.rpc.ApiException - if the remote call failspublic final com.google.api.gax.rpc.UnaryCallable<CreateToolVersionRequest,ToolVersion> createToolVersionCallable()
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (ToolsClient toolsClient = ToolsClient.create()) {
CreateToolVersionRequest request =
CreateToolVersionRequest.newBuilder()
.setParent(ToolName.of("[PROJECT]", "[LOCATION]", "[AGENT]", "[TOOL]").toString())
.setToolVersion(ToolVersion.newBuilder().build())
.build();
ApiFuture<ToolVersion> future = toolsClient.createToolVersionCallable().futureCall(request);
// Do something.
ToolVersion response = future.get();
}
public final ToolVersion getToolVersion(ToolVersionName name)
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (ToolsClient toolsClient = ToolsClient.create()) {
ToolVersionName name =
ToolVersionName.of("[PROJECT]", "[LOCATION]", "[AGENT]", "[TOOL]", "[VERSION]");
ToolVersion response = toolsClient.getToolVersion(name);
}
name - Required. The name of the tool version. Format:
`projects/<ProjectID>/locations/<LocationID>/agents/<AgentID>/tools/<ToolID>/versions/<VersionID>`.com.google.api.gax.rpc.ApiException - if the remote call failspublic final ToolVersion getToolVersion(String name)
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (ToolsClient toolsClient = ToolsClient.create()) {
String name =
ToolVersionName.of("[PROJECT]", "[LOCATION]", "[AGENT]", "[TOOL]", "[VERSION]")
.toString();
ToolVersion response = toolsClient.getToolVersion(name);
}
name - Required. The name of the tool version. Format:
`projects/<ProjectID>/locations/<LocationID>/agents/<AgentID>/tools/<ToolID>/versions/<VersionID>`.com.google.api.gax.rpc.ApiException - if the remote call failspublic final ToolVersion getToolVersion(GetToolVersionRequest request)
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (ToolsClient toolsClient = ToolsClient.create()) {
GetToolVersionRequest request =
GetToolVersionRequest.newBuilder()
.setName(
ToolVersionName.of("[PROJECT]", "[LOCATION]", "[AGENT]", "[TOOL]", "[VERSION]")
.toString())
.build();
ToolVersion response = toolsClient.getToolVersion(request);
}
request - The request object containing all of the parameters for the API call.com.google.api.gax.rpc.ApiException - if the remote call failspublic final com.google.api.gax.rpc.UnaryCallable<GetToolVersionRequest,ToolVersion> getToolVersionCallable()
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (ToolsClient toolsClient = ToolsClient.create()) {
GetToolVersionRequest request =
GetToolVersionRequest.newBuilder()
.setName(
ToolVersionName.of("[PROJECT]", "[LOCATION]", "[AGENT]", "[TOOL]", "[VERSION]")
.toString())
.build();
ApiFuture<ToolVersion> future = toolsClient.getToolVersionCallable().futureCall(request);
// Do something.
ToolVersion response = future.get();
}
public final void deleteToolVersion(ToolVersionName name)
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (ToolsClient toolsClient = ToolsClient.create()) {
ToolVersionName name =
ToolVersionName.of("[PROJECT]", "[LOCATION]", "[AGENT]", "[TOOL]", "[VERSION]");
toolsClient.deleteToolVersion(name);
}
name - Required. The name of the tool version to delete. Format:
`projects/<ProjectID>/locations/<LocationID>/agents/<AgentID>/tools/<ToolID>/versions/<VersionID>`.com.google.api.gax.rpc.ApiException - if the remote call failspublic final void deleteToolVersion(String name)
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (ToolsClient toolsClient = ToolsClient.create()) {
String name =
ToolVersionName.of("[PROJECT]", "[LOCATION]", "[AGENT]", "[TOOL]", "[VERSION]")
.toString();
toolsClient.deleteToolVersion(name);
}
name - Required. The name of the tool version to delete. Format:
`projects/<ProjectID>/locations/<LocationID>/agents/<AgentID>/tools/<ToolID>/versions/<VersionID>`.com.google.api.gax.rpc.ApiException - if the remote call failspublic final void deleteToolVersion(DeleteToolVersionRequest request)
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (ToolsClient toolsClient = ToolsClient.create()) {
DeleteToolVersionRequest request =
DeleteToolVersionRequest.newBuilder()
.setName(
ToolVersionName.of("[PROJECT]", "[LOCATION]", "[AGENT]", "[TOOL]", "[VERSION]")
.toString())
.setForce(true)
.build();
toolsClient.deleteToolVersion(request);
}
request - The request object containing all of the parameters for the API call.com.google.api.gax.rpc.ApiException - if the remote call failspublic final com.google.api.gax.rpc.UnaryCallable<DeleteToolVersionRequest,com.google.protobuf.Empty> deleteToolVersionCallable()
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (ToolsClient toolsClient = ToolsClient.create()) {
DeleteToolVersionRequest request =
DeleteToolVersionRequest.newBuilder()
.setName(
ToolVersionName.of("[PROJECT]", "[LOCATION]", "[AGENT]", "[TOOL]", "[VERSION]")
.toString())
.setForce(true)
.build();
ApiFuture<Empty> future = toolsClient.deleteToolVersionCallable().futureCall(request);
// Do something.
future.get();
}
public final RestoreToolVersionResponse restoreToolVersion(ToolVersionName name)
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (ToolsClient toolsClient = ToolsClient.create()) {
ToolVersionName name =
ToolVersionName.of("[PROJECT]", "[LOCATION]", "[AGENT]", "[TOOL]", "[VERSION]");
RestoreToolVersionResponse response = toolsClient.restoreToolVersion(name);
}
name - Required. The name of the tool version. Format:
`projects/<ProjectID>/locations/<LocationID>/agents/<AgentID>/tools/<ToolID>/versions/<VersionID>`.com.google.api.gax.rpc.ApiException - if the remote call failspublic final RestoreToolVersionResponse restoreToolVersion(String name)
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (ToolsClient toolsClient = ToolsClient.create()) {
String name =
ToolVersionName.of("[PROJECT]", "[LOCATION]", "[AGENT]", "[TOOL]", "[VERSION]")
.toString();
RestoreToolVersionResponse response = toolsClient.restoreToolVersion(name);
}
name - Required. The name of the tool version. Format:
`projects/<ProjectID>/locations/<LocationID>/agents/<AgentID>/tools/<ToolID>/versions/<VersionID>`.com.google.api.gax.rpc.ApiException - if the remote call failspublic final RestoreToolVersionResponse restoreToolVersion(RestoreToolVersionRequest request)
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (ToolsClient toolsClient = ToolsClient.create()) {
RestoreToolVersionRequest request =
RestoreToolVersionRequest.newBuilder()
.setName(
ToolVersionName.of("[PROJECT]", "[LOCATION]", "[AGENT]", "[TOOL]", "[VERSION]")
.toString())
.build();
RestoreToolVersionResponse response = toolsClient.restoreToolVersion(request);
}
request - The request object containing all of the parameters for the API call.com.google.api.gax.rpc.ApiException - if the remote call failspublic final com.google.api.gax.rpc.UnaryCallable<RestoreToolVersionRequest,RestoreToolVersionResponse> restoreToolVersionCallable()
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (ToolsClient toolsClient = ToolsClient.create()) {
RestoreToolVersionRequest request =
RestoreToolVersionRequest.newBuilder()
.setName(
ToolVersionName.of("[PROJECT]", "[LOCATION]", "[AGENT]", "[TOOL]", "[VERSION]")
.toString())
.build();
ApiFuture<RestoreToolVersionResponse> future =
toolsClient.restoreToolVersionCallable().futureCall(request);
// Do something.
RestoreToolVersionResponse response = future.get();
}
public final ToolsClient.ListLocationsPagedResponse listLocations(com.google.cloud.location.ListLocationsRequest request)
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (ToolsClient toolsClient = ToolsClient.create()) {
ListLocationsRequest request =
ListLocationsRequest.newBuilder()
.setName("name3373707")
.setFilter("filter-1274492040")
.setPageSize(883849137)
.setPageToken("pageToken873572522")
.build();
for (Location element : toolsClient.listLocations(request).iterateAll()) {
// doThingsWith(element);
}
}
request - The request object containing all of the parameters for the API call.com.google.api.gax.rpc.ApiException - if the remote call failspublic final com.google.api.gax.rpc.UnaryCallable<com.google.cloud.location.ListLocationsRequest,ToolsClient.ListLocationsPagedResponse> listLocationsPagedCallable()
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (ToolsClient toolsClient = ToolsClient.create()) {
ListLocationsRequest request =
ListLocationsRequest.newBuilder()
.setName("name3373707")
.setFilter("filter-1274492040")
.setPageSize(883849137)
.setPageToken("pageToken873572522")
.build();
ApiFuture<Location> future = toolsClient.listLocationsPagedCallable().futureCall(request);
// Do something.
for (Location element : future.get().iterateAll()) {
// doThingsWith(element);
}
}
public final com.google.api.gax.rpc.UnaryCallable<com.google.cloud.location.ListLocationsRequest,com.google.cloud.location.ListLocationsResponse> listLocationsCallable()
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (ToolsClient toolsClient = ToolsClient.create()) {
ListLocationsRequest request =
ListLocationsRequest.newBuilder()
.setName("name3373707")
.setFilter("filter-1274492040")
.setPageSize(883849137)
.setPageToken("pageToken873572522")
.build();
while (true) {
ListLocationsResponse response = toolsClient.listLocationsCallable().call(request);
for (Location element : response.getLocationsList()) {
// doThingsWith(element);
}
String nextPageToken = response.getNextPageToken();
if (!Strings.isNullOrEmpty(nextPageToken)) {
request = request.toBuilder().setPageToken(nextPageToken).build();
} else {
break;
}
}
}
public final com.google.cloud.location.Location getLocation(com.google.cloud.location.GetLocationRequest request)
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (ToolsClient toolsClient = ToolsClient.create()) {
GetLocationRequest request = GetLocationRequest.newBuilder().setName("name3373707").build();
Location response = toolsClient.getLocation(request);
}
request - The request object containing all of the parameters for the API call.com.google.api.gax.rpc.ApiException - if the remote call failspublic final com.google.api.gax.rpc.UnaryCallable<com.google.cloud.location.GetLocationRequest,com.google.cloud.location.Location> getLocationCallable()
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (ToolsClient toolsClient = ToolsClient.create()) {
GetLocationRequest request = GetLocationRequest.newBuilder().setName("name3373707").build();
ApiFuture<Location> future = toolsClient.getLocationCallable().futureCall(request);
// Do something.
Location response = future.get();
}
public final void close()
close in interface AutoCloseablepublic void shutdown()
shutdown in interface com.google.api.gax.core.BackgroundResourcepublic boolean isShutdown()
isShutdown in interface com.google.api.gax.core.BackgroundResourcepublic boolean isTerminated()
isTerminated in interface com.google.api.gax.core.BackgroundResourcepublic void shutdownNow()
shutdownNow in interface com.google.api.gax.core.BackgroundResourcepublic boolean awaitTermination(long duration,
TimeUnit unit)
throws InterruptedException
awaitTermination in interface com.google.api.gax.core.BackgroundResourceInterruptedExceptionCopyright © 2025 Google LLC. All rights reserved.