@Generated(value="by gapic-generator-java") public class SessionEntityTypesClient 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 (SessionEntityTypesClient sessionEntityTypesClient = SessionEntityTypesClient.create()) {
SessionEntityTypeName name =
SessionEntityTypeName.ofProjectLocationAgentSessionEntityTypeName(
"[PROJECT]", "[LOCATION]", "[AGENT]", "[SESSION]", "[ENTITY_TYPE]");
SessionEntityType response = sessionEntityTypesClient.getSessionEntityType(name);
}
Note: close() needs to be called on the SessionEntityTypesClient 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 |
|---|---|---|
ListSessionEntityTypes |
Returns the list of all session entity types in the specified session. |
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.
|
GetSessionEntityType |
Retrieves the specified session entity type. |
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.
|
CreateSessionEntityType |
Creates a session entity type. |
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.
|
UpdateSessionEntityType |
Updates the specified session entity type. |
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.
|
DeleteSessionEntityType |
Deletes the specified session entity type. |
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 SessionEntityTypesSettings 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
SessionEntityTypesSettings sessionEntityTypesSettings =
SessionEntityTypesSettings.newBuilder()
.setCredentialsProvider(FixedCredentialsProvider.create(myCredentials))
.build();
SessionEntityTypesClient sessionEntityTypesClient =
SessionEntityTypesClient.create(sessionEntityTypesSettings);
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
SessionEntityTypesSettings sessionEntityTypesSettings =
SessionEntityTypesSettings.newBuilder().setEndpoint(myEndpoint).build();
SessionEntityTypesClient sessionEntityTypesClient =
SessionEntityTypesClient.create(sessionEntityTypesSettings);
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
SessionEntityTypesSettings sessionEntityTypesSettings =
SessionEntityTypesSettings.newHttpJsonBuilder().build();
SessionEntityTypesClient sessionEntityTypesClient =
SessionEntityTypesClient.create(sessionEntityTypesSettings);
Please refer to the GitHub repository's samples for more quickstart code snippets.
| Modifier and Type | Class and Description |
|---|---|
static class |
SessionEntityTypesClient.ListLocationsFixedSizeCollection |
static class |
SessionEntityTypesClient.ListLocationsPage |
static class |
SessionEntityTypesClient.ListLocationsPagedResponse |
static class |
SessionEntityTypesClient.ListSessionEntityTypesFixedSizeCollection |
static class |
SessionEntityTypesClient.ListSessionEntityTypesPage |
static class |
SessionEntityTypesClient.ListSessionEntityTypesPagedResponse |
| Modifier | Constructor and Description |
|---|---|
protected |
SessionEntityTypesClient(SessionEntityTypesSettings settings)
Constructs an instance of SessionEntityTypesClient, using the given settings.
|
protected |
SessionEntityTypesClient(SessionEntityTypesStub stub) |
| Modifier and Type | Method and Description |
|---|---|
boolean |
awaitTermination(long duration,
TimeUnit unit) |
void |
close() |
static SessionEntityTypesClient |
create()
Constructs an instance of SessionEntityTypesClient with default settings.
|
static SessionEntityTypesClient |
create(SessionEntityTypesSettings settings)
Constructs an instance of SessionEntityTypesClient, using the given settings.
|
static SessionEntityTypesClient |
create(SessionEntityTypesStub stub)
Constructs an instance of SessionEntityTypesClient, using the given stub for making calls.
|
SessionEntityType |
createSessionEntityType(CreateSessionEntityTypeRequest request)
Creates a session entity type.
|
SessionEntityType |
createSessionEntityType(SessionName parent,
SessionEntityType sessionEntityType)
Creates a session entity type.
|
SessionEntityType |
createSessionEntityType(String parent,
SessionEntityType sessionEntityType)
Creates a session entity type.
|
com.google.api.gax.rpc.UnaryCallable<CreateSessionEntityTypeRequest,SessionEntityType> |
createSessionEntityTypeCallable()
Creates a session entity type.
|
void |
deleteSessionEntityType(DeleteSessionEntityTypeRequest request)
Deletes the specified session entity type.
|
void |
deleteSessionEntityType(SessionEntityTypeName name)
Deletes the specified session entity type.
|
void |
deleteSessionEntityType(String name)
Deletes the specified session entity type.
|
com.google.api.gax.rpc.UnaryCallable<DeleteSessionEntityTypeRequest,com.google.protobuf.Empty> |
deleteSessionEntityTypeCallable()
Deletes the specified session entity type.
|
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.
|
SessionEntityType |
getSessionEntityType(GetSessionEntityTypeRequest request)
Retrieves the specified session entity type.
|
SessionEntityType |
getSessionEntityType(SessionEntityTypeName name)
Retrieves the specified session entity type.
|
SessionEntityType |
getSessionEntityType(String name)
Retrieves the specified session entity type.
|
com.google.api.gax.rpc.UnaryCallable<GetSessionEntityTypeRequest,SessionEntityType> |
getSessionEntityTypeCallable()
Retrieves the specified session entity type.
|
SessionEntityTypesSettings |
getSettings() |
SessionEntityTypesStub |
getStub() |
boolean |
isShutdown() |
boolean |
isTerminated() |
SessionEntityTypesClient.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,SessionEntityTypesClient.ListLocationsPagedResponse> |
listLocationsPagedCallable()
Lists information about the supported locations for this service.
|
SessionEntityTypesClient.ListSessionEntityTypesPagedResponse |
listSessionEntityTypes(ListSessionEntityTypesRequest request)
Returns the list of all session entity types in the specified session.
|
SessionEntityTypesClient.ListSessionEntityTypesPagedResponse |
listSessionEntityTypes(SessionName parent)
Returns the list of all session entity types in the specified session.
|
SessionEntityTypesClient.ListSessionEntityTypesPagedResponse |
listSessionEntityTypes(String parent)
Returns the list of all session entity types in the specified session.
|
com.google.api.gax.rpc.UnaryCallable<ListSessionEntityTypesRequest,ListSessionEntityTypesResponse> |
listSessionEntityTypesCallable()
Returns the list of all session entity types in the specified session.
|
com.google.api.gax.rpc.UnaryCallable<ListSessionEntityTypesRequest,SessionEntityTypesClient.ListSessionEntityTypesPagedResponse> |
listSessionEntityTypesPagedCallable()
Returns the list of all session entity types in the specified session.
|
void |
shutdown() |
void |
shutdownNow() |
SessionEntityType |
updateSessionEntityType(SessionEntityType sessionEntityType,
com.google.protobuf.FieldMask updateMask)
Updates the specified session entity type.
|
SessionEntityType |
updateSessionEntityType(UpdateSessionEntityTypeRequest request)
Updates the specified session entity type.
|
com.google.api.gax.rpc.UnaryCallable<UpdateSessionEntityTypeRequest,SessionEntityType> |
updateSessionEntityTypeCallable()
Updates the specified session entity type.
|
protected SessionEntityTypesClient(SessionEntityTypesSettings settings) throws IOException
IOExceptionprotected SessionEntityTypesClient(SessionEntityTypesStub stub)
public static final SessionEntityTypesClient create() throws IOException
IOExceptionpublic static final SessionEntityTypesClient create(SessionEntityTypesSettings settings) throws IOException
IOExceptionpublic static final SessionEntityTypesClient create(SessionEntityTypesStub stub)
public final SessionEntityTypesSettings getSettings()
public SessionEntityTypesStub getStub()
public final SessionEntityTypesClient.ListSessionEntityTypesPagedResponse listSessionEntityTypes(SessionName 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 (SessionEntityTypesClient sessionEntityTypesClient = SessionEntityTypesClient.create()) {
SessionName parent =
SessionName.ofProjectLocationAgentSessionName(
"[PROJECT]", "[LOCATION]", "[AGENT]", "[SESSION]");
for (SessionEntityType element :
sessionEntityTypesClient.listSessionEntityTypes(parent).iterateAll()) {
// doThingsWith(element);
}
}
parent - Required. The session to list all session entity types from. Format:
`projects/<ProjectID>/locations/<LocationID>/agents/<AgentID>/sessions/<SessionID>`
or
`projects/<ProjectID>/locations/<LocationID>/agents/<AgentID>/environments/<EnvironmentID>/sessions/<SessionID>`.
If `Environment ID` is not specified, we assume default 'draft' environment.com.google.api.gax.rpc.ApiException - if the remote call failspublic final SessionEntityTypesClient.ListSessionEntityTypesPagedResponse listSessionEntityTypes(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 (SessionEntityTypesClient sessionEntityTypesClient = SessionEntityTypesClient.create()) {
String parent =
SessionName.ofProjectLocationAgentSessionName(
"[PROJECT]", "[LOCATION]", "[AGENT]", "[SESSION]")
.toString();
for (SessionEntityType element :
sessionEntityTypesClient.listSessionEntityTypes(parent).iterateAll()) {
// doThingsWith(element);
}
}
parent - Required. The session to list all session entity types from. Format:
`projects/<ProjectID>/locations/<LocationID>/agents/<AgentID>/sessions/<SessionID>`
or
`projects/<ProjectID>/locations/<LocationID>/agents/<AgentID>/environments/<EnvironmentID>/sessions/<SessionID>`.
If `Environment ID` is not specified, we assume default 'draft' environment.com.google.api.gax.rpc.ApiException - if the remote call failspublic final SessionEntityTypesClient.ListSessionEntityTypesPagedResponse listSessionEntityTypes(ListSessionEntityTypesRequest 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 (SessionEntityTypesClient sessionEntityTypesClient = SessionEntityTypesClient.create()) {
ListSessionEntityTypesRequest request =
ListSessionEntityTypesRequest.newBuilder()
.setParent(
SessionName.ofProjectLocationAgentSessionName(
"[PROJECT]", "[LOCATION]", "[AGENT]", "[SESSION]")
.toString())
.setPageSize(883849137)
.setPageToken("pageToken873572522")
.build();
for (SessionEntityType element :
sessionEntityTypesClient.listSessionEntityTypes(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<ListSessionEntityTypesRequest,SessionEntityTypesClient.ListSessionEntityTypesPagedResponse> listSessionEntityTypesPagedCallable()
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 (SessionEntityTypesClient sessionEntityTypesClient = SessionEntityTypesClient.create()) {
ListSessionEntityTypesRequest request =
ListSessionEntityTypesRequest.newBuilder()
.setParent(
SessionName.ofProjectLocationAgentSessionName(
"[PROJECT]", "[LOCATION]", "[AGENT]", "[SESSION]")
.toString())
.setPageSize(883849137)
.setPageToken("pageToken873572522")
.build();
ApiFuture<SessionEntityType> future =
sessionEntityTypesClient.listSessionEntityTypesPagedCallable().futureCall(request);
// Do something.
for (SessionEntityType element : future.get().iterateAll()) {
// doThingsWith(element);
}
}
public final com.google.api.gax.rpc.UnaryCallable<ListSessionEntityTypesRequest,ListSessionEntityTypesResponse> listSessionEntityTypesCallable()
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 (SessionEntityTypesClient sessionEntityTypesClient = SessionEntityTypesClient.create()) {
ListSessionEntityTypesRequest request =
ListSessionEntityTypesRequest.newBuilder()
.setParent(
SessionName.ofProjectLocationAgentSessionName(
"[PROJECT]", "[LOCATION]", "[AGENT]", "[SESSION]")
.toString())
.setPageSize(883849137)
.setPageToken("pageToken873572522")
.build();
while (true) {
ListSessionEntityTypesResponse response =
sessionEntityTypesClient.listSessionEntityTypesCallable().call(request);
for (SessionEntityType element : response.getSessionEntityTypesList()) {
// doThingsWith(element);
}
String nextPageToken = response.getNextPageToken();
if (!Strings.isNullOrEmpty(nextPageToken)) {
request = request.toBuilder().setPageToken(nextPageToken).build();
} else {
break;
}
}
}
public final SessionEntityType getSessionEntityType(SessionEntityTypeName 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 (SessionEntityTypesClient sessionEntityTypesClient = SessionEntityTypesClient.create()) {
SessionEntityTypeName name =
SessionEntityTypeName.ofProjectLocationAgentSessionEntityTypeName(
"[PROJECT]", "[LOCATION]", "[AGENT]", "[SESSION]", "[ENTITY_TYPE]");
SessionEntityType response = sessionEntityTypesClient.getSessionEntityType(name);
}
name - Required. The name of the session entity type. Format:
`projects/<ProjectID>/locations/<LocationID>/agents/<AgentID>/sessions/<SessionID>/entityTypes/<EntityTypeID>`
or
`projects/<ProjectID>/locations/<LocationID>/agents/<AgentID>/environments/<EnvironmentID>/sessions/<SessionID>/entityTypes/<EntityTypeID>`.
If `Environment ID` is not specified, we assume default 'draft' environment.com.google.api.gax.rpc.ApiException - if the remote call failspublic final SessionEntityType getSessionEntityType(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 (SessionEntityTypesClient sessionEntityTypesClient = SessionEntityTypesClient.create()) {
String name =
SessionEntityTypeName.ofProjectLocationAgentSessionEntityTypeName(
"[PROJECT]", "[LOCATION]", "[AGENT]", "[SESSION]", "[ENTITY_TYPE]")
.toString();
SessionEntityType response = sessionEntityTypesClient.getSessionEntityType(name);
}
name - Required. The name of the session entity type. Format:
`projects/<ProjectID>/locations/<LocationID>/agents/<AgentID>/sessions/<SessionID>/entityTypes/<EntityTypeID>`
or
`projects/<ProjectID>/locations/<LocationID>/agents/<AgentID>/environments/<EnvironmentID>/sessions/<SessionID>/entityTypes/<EntityTypeID>`.
If `Environment ID` is not specified, we assume default 'draft' environment.com.google.api.gax.rpc.ApiException - if the remote call failspublic final SessionEntityType getSessionEntityType(GetSessionEntityTypeRequest 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 (SessionEntityTypesClient sessionEntityTypesClient = SessionEntityTypesClient.create()) {
GetSessionEntityTypeRequest request =
GetSessionEntityTypeRequest.newBuilder()
.setName(
SessionEntityTypeName.ofProjectLocationAgentSessionEntityTypeName(
"[PROJECT]", "[LOCATION]", "[AGENT]", "[SESSION]", "[ENTITY_TYPE]")
.toString())
.build();
SessionEntityType response = sessionEntityTypesClient.getSessionEntityType(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<GetSessionEntityTypeRequest,SessionEntityType> getSessionEntityTypeCallable()
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 (SessionEntityTypesClient sessionEntityTypesClient = SessionEntityTypesClient.create()) {
GetSessionEntityTypeRequest request =
GetSessionEntityTypeRequest.newBuilder()
.setName(
SessionEntityTypeName.ofProjectLocationAgentSessionEntityTypeName(
"[PROJECT]", "[LOCATION]", "[AGENT]", "[SESSION]", "[ENTITY_TYPE]")
.toString())
.build();
ApiFuture<SessionEntityType> future =
sessionEntityTypesClient.getSessionEntityTypeCallable().futureCall(request);
// Do something.
SessionEntityType response = future.get();
}
public final SessionEntityType createSessionEntityType(SessionName parent, SessionEntityType sessionEntityType)
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 (SessionEntityTypesClient sessionEntityTypesClient = SessionEntityTypesClient.create()) {
SessionName parent =
SessionName.ofProjectLocationAgentSessionName(
"[PROJECT]", "[LOCATION]", "[AGENT]", "[SESSION]");
SessionEntityType sessionEntityType = SessionEntityType.newBuilder().build();
SessionEntityType response =
sessionEntityTypesClient.createSessionEntityType(parent, sessionEntityType);
}
parent - Required. The session to create a session entity type for. Format:
`projects/<ProjectID>/locations/<LocationID>/agents/<AgentID>/sessions/<SessionID>`
or
`projects/<ProjectID>/locations/<LocationID>/agents/<AgentID>/environments/<EnvironmentID>/sessions/<SessionID>`.
If `Environment ID` is not specified, we assume default 'draft' environment.sessionEntityType - Required. The session entity type to create.com.google.api.gax.rpc.ApiException - if the remote call failspublic final SessionEntityType createSessionEntityType(String parent, SessionEntityType sessionEntityType)
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 (SessionEntityTypesClient sessionEntityTypesClient = SessionEntityTypesClient.create()) {
String parent =
SessionName.ofProjectLocationAgentSessionName(
"[PROJECT]", "[LOCATION]", "[AGENT]", "[SESSION]")
.toString();
SessionEntityType sessionEntityType = SessionEntityType.newBuilder().build();
SessionEntityType response =
sessionEntityTypesClient.createSessionEntityType(parent, sessionEntityType);
}
parent - Required. The session to create a session entity type for. Format:
`projects/<ProjectID>/locations/<LocationID>/agents/<AgentID>/sessions/<SessionID>`
or
`projects/<ProjectID>/locations/<LocationID>/agents/<AgentID>/environments/<EnvironmentID>/sessions/<SessionID>`.
If `Environment ID` is not specified, we assume default 'draft' environment.sessionEntityType - Required. The session entity type to create.com.google.api.gax.rpc.ApiException - if the remote call failspublic final SessionEntityType createSessionEntityType(CreateSessionEntityTypeRequest 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 (SessionEntityTypesClient sessionEntityTypesClient = SessionEntityTypesClient.create()) {
CreateSessionEntityTypeRequest request =
CreateSessionEntityTypeRequest.newBuilder()
.setParent(
SessionName.ofProjectLocationAgentSessionName(
"[PROJECT]", "[LOCATION]", "[AGENT]", "[SESSION]")
.toString())
.setSessionEntityType(SessionEntityType.newBuilder().build())
.build();
SessionEntityType response = sessionEntityTypesClient.createSessionEntityType(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<CreateSessionEntityTypeRequest,SessionEntityType> createSessionEntityTypeCallable()
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 (SessionEntityTypesClient sessionEntityTypesClient = SessionEntityTypesClient.create()) {
CreateSessionEntityTypeRequest request =
CreateSessionEntityTypeRequest.newBuilder()
.setParent(
SessionName.ofProjectLocationAgentSessionName(
"[PROJECT]", "[LOCATION]", "[AGENT]", "[SESSION]")
.toString())
.setSessionEntityType(SessionEntityType.newBuilder().build())
.build();
ApiFuture<SessionEntityType> future =
sessionEntityTypesClient.createSessionEntityTypeCallable().futureCall(request);
// Do something.
SessionEntityType response = future.get();
}
public final SessionEntityType updateSessionEntityType(SessionEntityType sessionEntityType, 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 (SessionEntityTypesClient sessionEntityTypesClient = SessionEntityTypesClient.create()) {
SessionEntityType sessionEntityType = SessionEntityType.newBuilder().build();
FieldMask updateMask = FieldMask.newBuilder().build();
SessionEntityType response =
sessionEntityTypesClient.updateSessionEntityType(sessionEntityType, updateMask);
}
sessionEntityType - Required. The session entity type to update. Format:
`projects/<ProjectID>/locations/<LocationID>/agents/<AgentID>/sessions/<SessionID>/entityTypes/<EntityTypeID>`
or
`projects/<ProjectID>/locations/<LocationID>/agents/<AgentID>/environments/<EnvironmentID>/sessions/<SessionID>/entityTypes/<EntityTypeID>`.
If `Environment ID` is not specified, we assume default 'draft' environment.updateMask - The mask to control which fields get updated.com.google.api.gax.rpc.ApiException - if the remote call failspublic final SessionEntityType updateSessionEntityType(UpdateSessionEntityTypeRequest 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 (SessionEntityTypesClient sessionEntityTypesClient = SessionEntityTypesClient.create()) {
UpdateSessionEntityTypeRequest request =
UpdateSessionEntityTypeRequest.newBuilder()
.setSessionEntityType(SessionEntityType.newBuilder().build())
.setUpdateMask(FieldMask.newBuilder().build())
.build();
SessionEntityType response = sessionEntityTypesClient.updateSessionEntityType(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<UpdateSessionEntityTypeRequest,SessionEntityType> updateSessionEntityTypeCallable()
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 (SessionEntityTypesClient sessionEntityTypesClient = SessionEntityTypesClient.create()) {
UpdateSessionEntityTypeRequest request =
UpdateSessionEntityTypeRequest.newBuilder()
.setSessionEntityType(SessionEntityType.newBuilder().build())
.setUpdateMask(FieldMask.newBuilder().build())
.build();
ApiFuture<SessionEntityType> future =
sessionEntityTypesClient.updateSessionEntityTypeCallable().futureCall(request);
// Do something.
SessionEntityType response = future.get();
}
public final void deleteSessionEntityType(SessionEntityTypeName 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 (SessionEntityTypesClient sessionEntityTypesClient = SessionEntityTypesClient.create()) {
SessionEntityTypeName name =
SessionEntityTypeName.ofProjectLocationAgentSessionEntityTypeName(
"[PROJECT]", "[LOCATION]", "[AGENT]", "[SESSION]", "[ENTITY_TYPE]");
sessionEntityTypesClient.deleteSessionEntityType(name);
}
name - Required. The name of the session entity type to delete. Format:
`projects/<ProjectID>/locations/<LocationID>/agents/<AgentID>/sessions/<SessionID>/entityTypes/<EntityTypeID>`
or
`projects/<ProjectID>/locations/<LocationID>/agents/<AgentID>/environments/<EnvironmentID>/sessions/<SessionID>/entityTypes/<EntityTypeID>`.
If `Environment ID` is not specified, we assume default 'draft' environment.com.google.api.gax.rpc.ApiException - if the remote call failspublic final void deleteSessionEntityType(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 (SessionEntityTypesClient sessionEntityTypesClient = SessionEntityTypesClient.create()) {
String name =
SessionEntityTypeName.ofProjectLocationAgentSessionEntityTypeName(
"[PROJECT]", "[LOCATION]", "[AGENT]", "[SESSION]", "[ENTITY_TYPE]")
.toString();
sessionEntityTypesClient.deleteSessionEntityType(name);
}
name - Required. The name of the session entity type to delete. Format:
`projects/<ProjectID>/locations/<LocationID>/agents/<AgentID>/sessions/<SessionID>/entityTypes/<EntityTypeID>`
or
`projects/<ProjectID>/locations/<LocationID>/agents/<AgentID>/environments/<EnvironmentID>/sessions/<SessionID>/entityTypes/<EntityTypeID>`.
If `Environment ID` is not specified, we assume default 'draft' environment.com.google.api.gax.rpc.ApiException - if the remote call failspublic final void deleteSessionEntityType(DeleteSessionEntityTypeRequest 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 (SessionEntityTypesClient sessionEntityTypesClient = SessionEntityTypesClient.create()) {
DeleteSessionEntityTypeRequest request =
DeleteSessionEntityTypeRequest.newBuilder()
.setName(
SessionEntityTypeName.ofProjectLocationAgentSessionEntityTypeName(
"[PROJECT]", "[LOCATION]", "[AGENT]", "[SESSION]", "[ENTITY_TYPE]")
.toString())
.build();
sessionEntityTypesClient.deleteSessionEntityType(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<DeleteSessionEntityTypeRequest,com.google.protobuf.Empty> deleteSessionEntityTypeCallable()
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 (SessionEntityTypesClient sessionEntityTypesClient = SessionEntityTypesClient.create()) {
DeleteSessionEntityTypeRequest request =
DeleteSessionEntityTypeRequest.newBuilder()
.setName(
SessionEntityTypeName.ofProjectLocationAgentSessionEntityTypeName(
"[PROJECT]", "[LOCATION]", "[AGENT]", "[SESSION]", "[ENTITY_TYPE]")
.toString())
.build();
ApiFuture<Empty> future =
sessionEntityTypesClient.deleteSessionEntityTypeCallable().futureCall(request);
// Do something.
future.get();
}
public final SessionEntityTypesClient.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 (SessionEntityTypesClient sessionEntityTypesClient = SessionEntityTypesClient.create()) {
ListLocationsRequest request =
ListLocationsRequest.newBuilder()
.setName("name3373707")
.setFilter("filter-1274492040")
.setPageSize(883849137)
.setPageToken("pageToken873572522")
.build();
for (Location element : sessionEntityTypesClient.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,SessionEntityTypesClient.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 (SessionEntityTypesClient sessionEntityTypesClient = SessionEntityTypesClient.create()) {
ListLocationsRequest request =
ListLocationsRequest.newBuilder()
.setName("name3373707")
.setFilter("filter-1274492040")
.setPageSize(883849137)
.setPageToken("pageToken873572522")
.build();
ApiFuture<Location> future =
sessionEntityTypesClient.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 (SessionEntityTypesClient sessionEntityTypesClient = SessionEntityTypesClient.create()) {
ListLocationsRequest request =
ListLocationsRequest.newBuilder()
.setName("name3373707")
.setFilter("filter-1274492040")
.setPageSize(883849137)
.setPageToken("pageToken873572522")
.build();
while (true) {
ListLocationsResponse response =
sessionEntityTypesClient.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 (SessionEntityTypesClient sessionEntityTypesClient = SessionEntityTypesClient.create()) {
GetLocationRequest request = GetLocationRequest.newBuilder().setName("name3373707").build();
Location response = sessionEntityTypesClient.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 (SessionEntityTypesClient sessionEntityTypesClient = SessionEntityTypesClient.create()) {
GetLocationRequest request = GetLocationRequest.newBuilder().setName("name3373707").build();
ApiFuture<Location> future =
sessionEntityTypesClient.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.