| GitHub Repository | Product Reference |
Service Description: Service for managing companion agents.
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 (CompanionAgentsClient companionAgentsClient = CompanionAgentsClient.create()) {
LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]");
CompanionAgent companionAgent = CompanionAgent.newBuilder().build();
String companionAgentId = "companionAgentId-580252076";
CompanionAgent response =
companionAgentsClient.createCompanionAgent(parent, companionAgent, companionAgentId);
}
Note: close() needs to be called on the CompanionAgentsClient 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 |
|---|---|---|
CreateCompanionAgent |
Creates a companion 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.
|
GetCompanionAgent |
Gets a companion 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.
|
UpdateCompanionAgent |
Updates a companion 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.
|
DeleteCompanionAgent |
Deletes a companion 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.
|
ListCompanionAgents |
Lists companion agents. |
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. This method lists locations based on the resource scope provided inthe ListLocationsRequest.name field: ***Global locations**: If For gRPC and client library implementations, the resource name ispassed as the |
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 CompanionAgentsSettings 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
CompanionAgentsSettings companionAgentsSettings =
CompanionAgentsSettings.newBuilder()
.setCredentialsProvider(FixedCredentialsProvider.create(myCredentials))
.build();
CompanionAgentsClient companionAgentsClient =
CompanionAgentsClient.create(companionAgentsSettings);
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
CompanionAgentsSettings companionAgentsSettings =
CompanionAgentsSettings.newBuilder().setEndpoint(myEndpoint).build();
CompanionAgentsClient companionAgentsClient =
CompanionAgentsClient.create(companionAgentsSettings);
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
CompanionAgentsSettings companionAgentsSettings =
CompanionAgentsSettings.newHttpJsonBuilder().build();
CompanionAgentsClient companionAgentsClient =
CompanionAgentsClient.create(companionAgentsSettings);
Please refer to the GitHub repository's samples for more quickstart code snippets.
Static Methods
create()
public static final CompanionAgentsClient create()Constructs an instance of CompanionAgentsClient with default settings.
| Returns | |
|---|---|
| Type | Description |
CompanionAgentsClient |
|
| Exceptions | |
|---|---|
| Type | Description |
IOException |
|
create(CompanionAgentsSettings settings)
public static final CompanionAgentsClient create(CompanionAgentsSettings settings)Constructs an instance of CompanionAgentsClient, using the given settings. The channels are created based on the settings passed in, or defaults for any settings that are not set.
| Parameter | |
|---|---|
| Name | Description |
settings |
CompanionAgentsSettings |
| Returns | |
|---|---|
| Type | Description |
CompanionAgentsClient |
|
| Exceptions | |
|---|---|
| Type | Description |
IOException |
|
create(CompanionAgentsStub stub)
public static final CompanionAgentsClient create(CompanionAgentsStub stub)Constructs an instance of CompanionAgentsClient, using the given stub for making calls. This is for advanced usage - prefer using create(CompanionAgentsSettings).
| Parameter | |
|---|---|
| Name | Description |
stub |
CompanionAgentsStub |
| Returns | |
|---|---|
| Type | Description |
CompanionAgentsClient |
|
Constructors
CompanionAgentsClient(CompanionAgentsSettings settings)
protected CompanionAgentsClient(CompanionAgentsSettings settings)Constructs an instance of CompanionAgentsClient, 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.
| Parameter | |
|---|---|
| Name | Description |
settings |
CompanionAgentsSettings |
CompanionAgentsClient(CompanionAgentsStub stub)
protected CompanionAgentsClient(CompanionAgentsStub stub)| Parameter | |
|---|---|
| Name | Description |
stub |
CompanionAgentsStub |
Methods
awaitTermination(long duration, TimeUnit unit)
public boolean awaitTermination(long duration, TimeUnit unit)| Parameters | |
|---|---|
| Name | Description |
duration |
long |
unit |
TimeUnit |
| Returns | |
|---|---|
| Type | Description |
boolean |
|
| Exceptions | |
|---|---|
| Type | Description |
InterruptedException |
|
close()
public final void close()createCompanionAgent(@Nullable LocationName parent, CompanionAgent companionAgent, String companionAgentId)
public final CompanionAgent createCompanionAgent(@Nullable LocationName parent, CompanionAgent companionAgent, String companionAgentId)Creates a companion agent.
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 (CompanionAgentsClient companionAgentsClient = CompanionAgentsClient.create()) {
LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]");
CompanionAgent companionAgent = CompanionAgent.newBuilder().build();
String companionAgentId = "companionAgentId-580252076";
CompanionAgent response =
companionAgentsClient.createCompanionAgent(parent, companionAgent, companionAgentId);
}
| Parameters | |
|---|---|
| Name | Description |
parent |
@org.jspecify.annotations.Nullable com.google.cloud.dialogflow.v2.LocationNameRequired. Resource identifier of the project creating the companion agent.
Format: |
companionAgent |
CompanionAgentRequired. The companion agent to create. |
companionAgentId |
StringOptional. The resource ID of the companion agent to create. If not provided, the server will auto-generate a resource ID. |
| Returns | |
|---|---|
| Type | Description |
CompanionAgent |
|
createCompanionAgent(CreateCompanionAgentRequest request)
public final CompanionAgent createCompanionAgent(CreateCompanionAgentRequest request)Creates a companion agent.
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 (CompanionAgentsClient companionAgentsClient = CompanionAgentsClient.create()) {
CreateCompanionAgentRequest request =
CreateCompanionAgentRequest.newBuilder()
.setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString())
.setCompanionAgent(CompanionAgent.newBuilder().build())
.setCompanionAgentId("companionAgentId-580252076")
.build();
CompanionAgent response = companionAgentsClient.createCompanionAgent(request);
}
| Parameter | |
|---|---|
| Name | Description |
request |
CreateCompanionAgentRequestThe request object containing all of the parameters for the API call. |
| Returns | |
|---|---|
| Type | Description |
CompanionAgent |
|
createCompanionAgent(String parent, CompanionAgent companionAgent, String companionAgentId)
public final CompanionAgent createCompanionAgent(String parent, CompanionAgent companionAgent, String companionAgentId)Creates a companion agent.
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 (CompanionAgentsClient companionAgentsClient = CompanionAgentsClient.create()) {
String parent = LocationName.of("[PROJECT]", "[LOCATION]").toString();
CompanionAgent companionAgent = CompanionAgent.newBuilder().build();
String companionAgentId = "companionAgentId-580252076";
CompanionAgent response =
companionAgentsClient.createCompanionAgent(parent, companionAgent, companionAgentId);
}
| Parameters | |
|---|---|
| Name | Description |
parent |
StringRequired. Resource identifier of the project creating the companion agent.
Format: |
companionAgent |
CompanionAgentRequired. The companion agent to create. |
companionAgentId |
StringOptional. The resource ID of the companion agent to create. If not provided, the server will auto-generate a resource ID. |
| Returns | |
|---|---|
| Type | Description |
CompanionAgent |
|
createCompanionAgentCallable()
public final UnaryCallable<CreateCompanionAgentRequest,CompanionAgent> createCompanionAgentCallable()Creates a companion agent.
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 (CompanionAgentsClient companionAgentsClient = CompanionAgentsClient.create()) {
CreateCompanionAgentRequest request =
CreateCompanionAgentRequest.newBuilder()
.setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString())
.setCompanionAgent(CompanionAgent.newBuilder().build())
.setCompanionAgentId("companionAgentId-580252076")
.build();
ApiFuture<CompanionAgent> future =
companionAgentsClient.createCompanionAgentCallable().futureCall(request);
// Do something.
CompanionAgent response = future.get();
}
| Returns | |
|---|---|
| Type | Description |
UnaryCallable<CreateCompanionAgentRequest,CompanionAgent> |
|
deleteCompanionAgent(@Nullable CompanionAgentName name)
public final void deleteCompanionAgent(@Nullable CompanionAgentName name)Deletes a companion agent.
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 (CompanionAgentsClient companionAgentsClient = CompanionAgentsClient.create()) {
CompanionAgentName name =
CompanionAgentName.of("[PROJECT]", "[LOCATION]", "[COMPANION_AGENT]");
companionAgentsClient.deleteCompanionAgent(name);
}
| Parameter | |
|---|---|
| Name | Description |
name |
@org.jspecify.annotations.Nullable com.google.cloud.dialogflow.v2.CompanionAgentNameRequired. The unique resource identifier of the CompanionAgent to delete. Format:
|
deleteCompanionAgent(DeleteCompanionAgentRequest request)
public final void deleteCompanionAgent(DeleteCompanionAgentRequest request)Deletes a companion agent.
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 (CompanionAgentsClient companionAgentsClient = CompanionAgentsClient.create()) {
DeleteCompanionAgentRequest request =
DeleteCompanionAgentRequest.newBuilder()
.setName(
CompanionAgentName.of("[PROJECT]", "[LOCATION]", "[COMPANION_AGENT]").toString())
.build();
companionAgentsClient.deleteCompanionAgent(request);
}
| Parameter | |
|---|---|
| Name | Description |
request |
DeleteCompanionAgentRequestThe request object containing all of the parameters for the API call. |
deleteCompanionAgent(String name)
public final void deleteCompanionAgent(String name)Deletes a companion agent.
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 (CompanionAgentsClient companionAgentsClient = CompanionAgentsClient.create()) {
String name =
CompanionAgentName.of("[PROJECT]", "[LOCATION]", "[COMPANION_AGENT]").toString();
companionAgentsClient.deleteCompanionAgent(name);
}
| Parameter | |
|---|---|
| Name | Description |
name |
StringRequired. The unique resource identifier of the CompanionAgent to delete. Format:
|
deleteCompanionAgentCallable()
public final UnaryCallable<DeleteCompanionAgentRequest,Empty> deleteCompanionAgentCallable()Deletes a companion agent.
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 (CompanionAgentsClient companionAgentsClient = CompanionAgentsClient.create()) {
DeleteCompanionAgentRequest request =
DeleteCompanionAgentRequest.newBuilder()
.setName(
CompanionAgentName.of("[PROJECT]", "[LOCATION]", "[COMPANION_AGENT]").toString())
.build();
ApiFuture<Empty> future =
companionAgentsClient.deleteCompanionAgentCallable().futureCall(request);
// Do something.
future.get();
}
| Returns | |
|---|---|
| Type | Description |
UnaryCallable<DeleteCompanionAgentRequest,Empty> |
|
getCompanionAgent(@Nullable CompanionAgentName name)
public final CompanionAgent getCompanionAgent(@Nullable CompanionAgentName name)Gets a companion agent.
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 (CompanionAgentsClient companionAgentsClient = CompanionAgentsClient.create()) {
CompanionAgentName name =
CompanionAgentName.of("[PROJECT]", "[LOCATION]", "[COMPANION_AGENT]");
CompanionAgent response = companionAgentsClient.getCompanionAgent(name);
}
| Parameter | |
|---|---|
| Name | Description |
name |
@org.jspecify.annotations.Nullable com.google.cloud.dialogflow.v2.CompanionAgentNameRequired. The unique resource identifier of the CompanionAgent to get all
information for. Format:
|
| Returns | |
|---|---|
| Type | Description |
CompanionAgent |
|
getCompanionAgent(GetCompanionAgentRequest request)
public final CompanionAgent getCompanionAgent(GetCompanionAgentRequest request)Gets a companion agent.
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 (CompanionAgentsClient companionAgentsClient = CompanionAgentsClient.create()) {
GetCompanionAgentRequest request =
GetCompanionAgentRequest.newBuilder()
.setName(
CompanionAgentName.of("[PROJECT]", "[LOCATION]", "[COMPANION_AGENT]").toString())
.build();
CompanionAgent response = companionAgentsClient.getCompanionAgent(request);
}
| Parameter | |
|---|---|
| Name | Description |
request |
GetCompanionAgentRequestThe request object containing all of the parameters for the API call. |
| Returns | |
|---|---|
| Type | Description |
CompanionAgent |
|
getCompanionAgent(String name)
public final CompanionAgent getCompanionAgent(String name)Gets a companion agent.
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 (CompanionAgentsClient companionAgentsClient = CompanionAgentsClient.create()) {
String name =
CompanionAgentName.of("[PROJECT]", "[LOCATION]", "[COMPANION_AGENT]").toString();
CompanionAgent response = companionAgentsClient.getCompanionAgent(name);
}
| Parameter | |
|---|---|
| Name | Description |
name |
StringRequired. The unique resource identifier of the CompanionAgent to get all
information for. Format:
|
| Returns | |
|---|---|
| Type | Description |
CompanionAgent |
|
getCompanionAgentCallable()
public final UnaryCallable<GetCompanionAgentRequest,CompanionAgent> getCompanionAgentCallable()Gets a companion agent.
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 (CompanionAgentsClient companionAgentsClient = CompanionAgentsClient.create()) {
GetCompanionAgentRequest request =
GetCompanionAgentRequest.newBuilder()
.setName(
CompanionAgentName.of("[PROJECT]", "[LOCATION]", "[COMPANION_AGENT]").toString())
.build();
ApiFuture<CompanionAgent> future =
companionAgentsClient.getCompanionAgentCallable().futureCall(request);
// Do something.
CompanionAgent response = future.get();
}
| Returns | |
|---|---|
| Type | Description |
UnaryCallable<GetCompanionAgentRequest,CompanionAgent> |
|
getLocation(GetLocationRequest request)
public final Location getLocation(GetLocationRequest request)Gets information about a location.
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (CompanionAgentsClient companionAgentsClient = CompanionAgentsClient.create()) {
GetLocationRequest request = GetLocationRequest.newBuilder().setName("name3373707").build();
Location response = companionAgentsClient.getLocation(request);
}
| Parameter | |
|---|---|
| Name | Description |
request |
com.google.cloud.location.GetLocationRequestThe request object containing all of the parameters for the API call. |
| Returns | |
|---|---|
| Type | Description |
com.google.cloud.location.Location |
|
getLocationCallable()
public final UnaryCallable<GetLocationRequest,Location> getLocationCallable()Gets information about a location.
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (CompanionAgentsClient companionAgentsClient = CompanionAgentsClient.create()) {
GetLocationRequest request = GetLocationRequest.newBuilder().setName("name3373707").build();
ApiFuture<Location> future = companionAgentsClient.getLocationCallable().futureCall(request);
// Do something.
Location response = future.get();
}
| Returns | |
|---|---|
| Type | Description |
UnaryCallable<com.google.cloud.location.GetLocationRequest,com.google.cloud.location.Location> |
|
getSettings()
public final @Nullable CompanionAgentsSettings getSettings()| Returns | |
|---|---|
| Type | Description |
@org.jspecify.annotations.Nullable com.google.cloud.dialogflow.v2.CompanionAgentsSettings |
|
getStub()
public CompanionAgentsStub getStub()| Returns | |
|---|---|
| Type | Description |
CompanionAgentsStub |
|
isShutdown()
public boolean isShutdown()| Returns | |
|---|---|
| Type | Description |
boolean |
|
isTerminated()
public boolean isTerminated()| Returns | |
|---|---|
| Type | Description |
boolean |
|
listCompanionAgents(@Nullable LocationName parent)
public final CompanionAgentsClient.ListCompanionAgentsPagedResponse listCompanionAgents(@Nullable LocationName parent)Lists companion agents.
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 (CompanionAgentsClient companionAgentsClient = CompanionAgentsClient.create()) {
LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]");
for (CompanionAgent element :
companionAgentsClient.listCompanionAgents(parent).iterateAll()) {
// doThingsWith(element);
}
}
| Parameter | |
|---|---|
| Name | Description |
parent |
@org.jspecify.annotations.Nullable com.google.cloud.dialogflow.v2.LocationNameRequired. The parent resource name to list the companion agents for. Format:
|
| Returns | |
|---|---|
| Type | Description |
CompanionAgentsClient.ListCompanionAgentsPagedResponse |
|
listCompanionAgents(ListCompanionAgentsRequest request)
public final CompanionAgentsClient.ListCompanionAgentsPagedResponse listCompanionAgents(ListCompanionAgentsRequest request)Lists companion agents.
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 (CompanionAgentsClient companionAgentsClient = CompanionAgentsClient.create()) {
ListCompanionAgentsRequest request =
ListCompanionAgentsRequest.newBuilder()
.setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString())
.setPageSize(883849137)
.setPageToken("pageToken873572522")
.build();
for (CompanionAgent element :
companionAgentsClient.listCompanionAgents(request).iterateAll()) {
// doThingsWith(element);
}
}
| Parameter | |
|---|---|
| Name | Description |
request |
ListCompanionAgentsRequestThe request object containing all of the parameters for the API call. |
| Returns | |
|---|---|
| Type | Description |
CompanionAgentsClient.ListCompanionAgentsPagedResponse |
|
listCompanionAgents(String parent)
public final CompanionAgentsClient.ListCompanionAgentsPagedResponse listCompanionAgents(String parent)Lists companion agents.
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 (CompanionAgentsClient companionAgentsClient = CompanionAgentsClient.create()) {
String parent = LocationName.of("[PROJECT]", "[LOCATION]").toString();
for (CompanionAgent element :
companionAgentsClient.listCompanionAgents(parent).iterateAll()) {
// doThingsWith(element);
}
}
| Parameter | |
|---|---|
| Name | Description |
parent |
StringRequired. The parent resource name to list the companion agents for. Format:
|
| Returns | |
|---|---|
| Type | Description |
CompanionAgentsClient.ListCompanionAgentsPagedResponse |
|
listCompanionAgentsCallable()
public final UnaryCallable<ListCompanionAgentsRequest,ListCompanionAgentsResponse> listCompanionAgentsCallable()Lists companion agents.
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 (CompanionAgentsClient companionAgentsClient = CompanionAgentsClient.create()) {
ListCompanionAgentsRequest request =
ListCompanionAgentsRequest.newBuilder()
.setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString())
.setPageSize(883849137)
.setPageToken("pageToken873572522")
.build();
while (true) {
ListCompanionAgentsResponse response =
companionAgentsClient.listCompanionAgentsCallable().call(request);
for (CompanionAgent element : response.getCompanionAgentsList()) {
// doThingsWith(element);
}
String nextPageToken = response.getNextPageToken();
if (!Strings.isNullOrEmpty(nextPageToken)) {
request = request.toBuilder().setPageToken(nextPageToken).build();
} else {
break;
}
}
}
| Returns | |
|---|---|
| Type | Description |
UnaryCallable<ListCompanionAgentsRequest,ListCompanionAgentsResponse> |
|
listCompanionAgentsPagedCallable()
public final UnaryCallable<ListCompanionAgentsRequest,CompanionAgentsClient.ListCompanionAgentsPagedResponse> listCompanionAgentsPagedCallable()Lists companion agents.
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 (CompanionAgentsClient companionAgentsClient = CompanionAgentsClient.create()) {
ListCompanionAgentsRequest request =
ListCompanionAgentsRequest.newBuilder()
.setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString())
.setPageSize(883849137)
.setPageToken("pageToken873572522")
.build();
ApiFuture<CompanionAgent> future =
companionAgentsClient.listCompanionAgentsPagedCallable().futureCall(request);
// Do something.
for (CompanionAgent element : future.get().iterateAll()) {
// doThingsWith(element);
}
}
| Returns | |
|---|---|
| Type | Description |
UnaryCallable<ListCompanionAgentsRequest,ListCompanionAgentsPagedResponse> |
|
listLocations(ListLocationsRequest request)
public final CompanionAgentsClient.ListLocationsPagedResponse listLocations(ListLocationsRequest request)Lists information about the supported locations for this service.
This method lists locations based on the resource scope provided inthe
ListLocationsRequest.name field:
***Global locations**: If name is empty, the method lists thepublic
locations available to all projects. * **Project-specificlocations**: If
name follows the formatprojects/{project}, the method lists locations visible to
thatspecific project. This includes public, private, or otherproject-specific locations enabled
for the project.
For gRPC and client library implementations, the resource name ispassed as the name field.
For direct service calls, the resourcename isincorporated into the request path based on the
specific serviceimplementation and version.
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 (CompanionAgentsClient companionAgentsClient = CompanionAgentsClient.create()) {
ListLocationsRequest request =
ListLocationsRequest.newBuilder()
.setName("name3373707")
.setFilter("filter-1274492040")
.setPageSize(883849137)
.setPageToken("pageToken873572522")
.build();
for (Location element : companionAgentsClient.listLocations(request).iterateAll()) {
// doThingsWith(element);
}
}
| Parameter | |
|---|---|
| Name | Description |
request |
com.google.cloud.location.ListLocationsRequestThe request object containing all of the parameters for the API call. |
| Returns | |
|---|---|
| Type | Description |
CompanionAgentsClient.ListLocationsPagedResponse |
|
listLocationsCallable()
public final UnaryCallable<ListLocationsRequest,ListLocationsResponse> listLocationsCallable()Lists information about the supported locations for this service.
This method lists locations based on the resource scope provided inthe
ListLocationsRequest.name field:
***Global locations**: If name is empty, the method lists thepublic
locations available to all projects. * **Project-specificlocations**: If
name follows the formatprojects/{project}, the method lists locations visible to
thatspecific project. This includes public, private, or otherproject-specific locations enabled
for the project.
For gRPC and client library implementations, the resource name ispassed as the name field.
For direct service calls, the resourcename isincorporated into the request path based on the
specific serviceimplementation and version.
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 (CompanionAgentsClient companionAgentsClient = CompanionAgentsClient.create()) {
ListLocationsRequest request =
ListLocationsRequest.newBuilder()
.setName("name3373707")
.setFilter("filter-1274492040")
.setPageSize(883849137)
.setPageToken("pageToken873572522")
.build();
while (true) {
ListLocationsResponse response =
companionAgentsClient.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;
}
}
}
| Returns | |
|---|---|
| Type | Description |
UnaryCallable<com.google.cloud.location.ListLocationsRequest,com.google.cloud.location.ListLocationsResponse> |
|
listLocationsPagedCallable()
public final UnaryCallable<ListLocationsRequest,CompanionAgentsClient.ListLocationsPagedResponse> listLocationsPagedCallable()Lists information about the supported locations for this service.
This method lists locations based on the resource scope provided inthe
ListLocationsRequest.name field:
***Global locations**: If name is empty, the method lists thepublic
locations available to all projects. * **Project-specificlocations**: If
name follows the formatprojects/{project}, the method lists locations visible to
thatspecific project. This includes public, private, or otherproject-specific locations enabled
for the project.
For gRPC and client library implementations, the resource name ispassed as the name field.
For direct service calls, the resourcename isincorporated into the request path based on the
specific serviceimplementation and version.
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 (CompanionAgentsClient companionAgentsClient = CompanionAgentsClient.create()) {
ListLocationsRequest request =
ListLocationsRequest.newBuilder()
.setName("name3373707")
.setFilter("filter-1274492040")
.setPageSize(883849137)
.setPageToken("pageToken873572522")
.build();
ApiFuture<Location> future =
companionAgentsClient.listLocationsPagedCallable().futureCall(request);
// Do something.
for (Location element : future.get().iterateAll()) {
// doThingsWith(element);
}
}
| Returns | |
|---|---|
| Type | Description |
UnaryCallable<com.google.cloud.location.ListLocationsRequest,ListLocationsPagedResponse> |
|
shutdown()
public void shutdown()shutdownNow()
public void shutdownNow()updateCompanionAgent(CompanionAgent companionAgent, FieldMask updateMask)
public final CompanionAgent updateCompanionAgent(CompanionAgent companionAgent, FieldMask updateMask)Updates a companion agent.
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 (CompanionAgentsClient companionAgentsClient = CompanionAgentsClient.create()) {
CompanionAgent companionAgent = CompanionAgent.newBuilder().build();
FieldMask updateMask = FieldMask.newBuilder().build();
CompanionAgent response =
companionAgentsClient.updateCompanionAgent(companionAgent, updateMask);
}
| Parameters | |
|---|---|
| Name | Description |
companionAgent |
CompanionAgentRequired. The Companion Agent to update. |
updateMask |
FieldMaskOptional. Update mask for Companion Agent. |
| Returns | |
|---|---|
| Type | Description |
CompanionAgent |
|
updateCompanionAgent(UpdateCompanionAgentRequest request)
public final CompanionAgent updateCompanionAgent(UpdateCompanionAgentRequest request)Updates a companion agent.
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 (CompanionAgentsClient companionAgentsClient = CompanionAgentsClient.create()) {
UpdateCompanionAgentRequest request =
UpdateCompanionAgentRequest.newBuilder()
.setCompanionAgent(CompanionAgent.newBuilder().build())
.setUpdateMask(FieldMask.newBuilder().build())
.build();
CompanionAgent response = companionAgentsClient.updateCompanionAgent(request);
}
| Parameter | |
|---|---|
| Name | Description |
request |
UpdateCompanionAgentRequestThe request object containing all of the parameters for the API call. |
| Returns | |
|---|---|
| Type | Description |
CompanionAgent |
|
updateCompanionAgentCallable()
public final UnaryCallable<UpdateCompanionAgentRequest,CompanionAgent> updateCompanionAgentCallable()Updates a companion agent.
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 (CompanionAgentsClient companionAgentsClient = CompanionAgentsClient.create()) {
UpdateCompanionAgentRequest request =
UpdateCompanionAgentRequest.newBuilder()
.setCompanionAgent(CompanionAgent.newBuilder().build())
.setUpdateMask(FieldMask.newBuilder().build())
.build();
ApiFuture<CompanionAgent> future =
companionAgentsClient.updateCompanionAgentCallable().futureCall(request);
// Do something.
CompanionAgent response = future.get();
}
| Returns | |
|---|---|
| Type | Description |
UnaryCallable<UpdateCompanionAgentRequest,CompanionAgent> |
|