diff --git a/generation_config.yaml b/generation_config.yaml index 8c63eb11a9d7..2b24dfcf59b8 100644 --- a/generation_config.yaml +++ b/generation_config.yaml @@ -1,5 +1,5 @@ gapic_generator_version: 2.67.0 -googleapis_commitish: dc505966accc82576fc1ebed3d7924fe9df4ab49 +googleapis_commitish: c662840a94dbdf708caa44893a2d49119cdd391c libraries_bom_version: 26.76.0 libraries: - api_shortname: accessapproval diff --git a/java-aiplatform/google-cloud-aiplatform/src/main/java/com/google/cloud/aiplatform/v1/SessionServiceClient.java b/java-aiplatform/google-cloud-aiplatform/src/main/java/com/google/cloud/aiplatform/v1/SessionServiceClient.java new file mode 100644 index 000000000000..1eeaea5fab1e --- /dev/null +++ b/java-aiplatform/google-cloud-aiplatform/src/main/java/com/google/cloud/aiplatform/v1/SessionServiceClient.java @@ -0,0 +1,2004 @@ +/* + * Copyright 2026 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1; + +import com.google.api.core.ApiFuture; +import com.google.api.core.ApiFutures; +import com.google.api.gax.core.BackgroundResource; +import com.google.api.gax.longrunning.OperationFuture; +import com.google.api.gax.paging.AbstractFixedSizeCollection; +import com.google.api.gax.paging.AbstractPage; +import com.google.api.gax.paging.AbstractPagedListResponse; +import com.google.api.gax.rpc.OperationCallable; +import com.google.api.gax.rpc.PageContext; +import com.google.api.gax.rpc.UnaryCallable; +import com.google.cloud.aiplatform.v1.stub.SessionServiceStub; +import com.google.cloud.aiplatform.v1.stub.SessionServiceStubSettings; +import com.google.cloud.location.GetLocationRequest; +import com.google.cloud.location.ListLocationsRequest; +import com.google.cloud.location.ListLocationsResponse; +import com.google.cloud.location.Location; +import com.google.common.util.concurrent.MoreExecutors; +import com.google.iam.v1.GetIamPolicyRequest; +import com.google.iam.v1.Policy; +import com.google.iam.v1.SetIamPolicyRequest; +import com.google.iam.v1.TestIamPermissionsRequest; +import com.google.iam.v1.TestIamPermissionsResponse; +import com.google.longrunning.Operation; +import com.google.longrunning.OperationsClient; +import com.google.protobuf.Empty; +import com.google.protobuf.FieldMask; +import java.io.IOException; +import java.util.List; +import java.util.concurrent.TimeUnit; +import javax.annotation.Generated; + +// AUTO-GENERATED DOCUMENTATION AND CLASS. +/** + * Service Description: The service that manages Vertex Session related resources. + * + *
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: + * + *
{@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 (SessionServiceClient sessionServiceClient = SessionServiceClient.create()) {
+ * SessionName name =
+ * SessionName.of("[PROJECT]", "[LOCATION]", "[REASONING_ENGINE]", "[SESSION]");
+ * Session response = sessionServiceClient.getSession(name);
+ * }
+ * }
+ *
+ * Note: close() needs to be called on the SessionServiceClient 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 | + *
|---|---|---|
CreateSession |
+ * Creates a new [Session][google.cloud.aiplatform.v1.Session]. |
+ *
+ * Request object method variants only take one parameter, a request object, which must be constructed before the call. + *
Methods that return long-running operations have "Async" method variants that return `OperationFuture`, which is used to track polling of the service. + *
Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service. + *
|
+ *
GetSession |
+ * Gets details of the specific [Session][google.cloud.aiplatform.v1.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. + *
|
+ *
ListSessions |
+ * Lists [Sessions][google.cloud.aiplatform.v1.Session] in a given reasoning engine. |
+ *
+ * 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. + *
|
+ *
UpdateSession |
+ * Updates the specific [Session][google.cloud.aiplatform.v1.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. + *
|
+ *
DeleteSession |
+ * Deletes details of the specific [Session][google.cloud.aiplatform.v1.Session]. |
+ *
+ * Request object method variants only take one parameter, a request object, which must be constructed before the call. + *
Methods that return long-running operations have "Async" method variants that return `OperationFuture`, which is used to track polling of the service. + *
Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service. + *
|
+ *
ListEvents |
+ * Lists [Events][google.cloud.aiplatform.v1.Event] in a given 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. + *
|
+ *
AppendEvent |
+ * Appends an event to a given 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. + *
|
+ *
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. + *
|
+ *
SetIamPolicy |
+ * Sets the access control policy on the specified resource. Replacesany existing policy. + * Can return `NOT_FOUND`, `INVALID_ARGUMENT`, and `PERMISSION_DENIED`errors. |
+ *
+ * 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. + *
|
+ *
GetIamPolicy |
+ * Gets the access control policy for a resource. Returns an empty policyif the resource exists and does not have a policy set. |
+ *
+ * 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. + *
|
+ *
TestIamPermissions |
+ * Returns permissions that a caller has on the specified resource. If theresource does not exist, this will return an empty set ofpermissions, not a `NOT_FOUND` error. + * Note: This operation is designed to be used for buildingpermission-aware UIs and command-line tools, not for authorizationchecking. This operation may "fail open" without warning. |
+ *
+ * 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 SessionServiceSettings to + * create(). For example: + * + *
To customize credentials: + * + *
{@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
+ * SessionServiceSettings sessionServiceSettings =
+ * SessionServiceSettings.newBuilder()
+ * .setCredentialsProvider(FixedCredentialsProvider.create(myCredentials))
+ * .build();
+ * SessionServiceClient sessionServiceClient = SessionServiceClient.create(sessionServiceSettings);
+ * }
+ *
+ * To customize the endpoint: + * + *
{@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
+ * SessionServiceSettings sessionServiceSettings =
+ * SessionServiceSettings.newBuilder().setEndpoint(myEndpoint).build();
+ * SessionServiceClient sessionServiceClient = SessionServiceClient.create(sessionServiceSettings);
+ * }
+ *
+ * Please refer to the GitHub repository's samples for more quickstart code snippets. + */ +@Generated("by gapic-generator-java") +public class SessionServiceClient implements BackgroundResource { + private final SessionServiceSettings settings; + private final SessionServiceStub stub; + private final OperationsClient operationsClient; + + /** Constructs an instance of SessionServiceClient with default settings. */ + public static final SessionServiceClient create() throws IOException { + return create(SessionServiceSettings.newBuilder().build()); + } + + /** + * Constructs an instance of SessionServiceClient, using the given settings. The channels are + * created based on the settings passed in, or defaults for any settings that are not set. + */ + public static final SessionServiceClient create(SessionServiceSettings settings) + throws IOException { + return new SessionServiceClient(settings); + } + + /** + * Constructs an instance of SessionServiceClient, using the given stub for making calls. This is + * for advanced usage - prefer using create(SessionServiceSettings). + */ + public static final SessionServiceClient create(SessionServiceStub stub) { + return new SessionServiceClient(stub); + } + + /** + * Constructs an instance of SessionServiceClient, using the given settings. This is protected so + * that it is easy to make a subclass, but otherwise, the static factory methods should be + * preferred. + */ + protected SessionServiceClient(SessionServiceSettings settings) throws IOException { + this.settings = settings; + this.stub = ((SessionServiceStubSettings) settings.getStubSettings()).createStub(); + this.operationsClient = OperationsClient.create(this.stub.getOperationsStub()); + } + + protected SessionServiceClient(SessionServiceStub stub) { + this.settings = null; + this.stub = stub; + this.operationsClient = OperationsClient.create(this.stub.getOperationsStub()); + } + + public final SessionServiceSettings getSettings() { + return settings; + } + + public SessionServiceStub getStub() { + return stub; + } + + /** + * Returns the OperationsClient that can be used to query the status of a long-running operation + * returned by another API method call. + */ + public final OperationsClient getOperationsClient() { + return operationsClient; + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Creates a new [Session][google.cloud.aiplatform.v1.Session]. + * + *
Sample code: + * + *
{@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 (SessionServiceClient sessionServiceClient = SessionServiceClient.create()) {
+ * ReasoningEngineName parent =
+ * ReasoningEngineName.of("[PROJECT]", "[LOCATION]", "[REASONING_ENGINE]");
+ * Session session = Session.newBuilder().build();
+ * Session response = sessionServiceClient.createSessionAsync(parent, session).get();
+ * }
+ * }
+ *
+ * @param parent Required. The resource name of the location to create the session in. Format:
+ * `projects/{project}/locations/{location}/reasoningEngines/{reasoning_engine}`
+ * @param session Required. The session to create.
+ * @throws com.google.api.gax.rpc.ApiException if the remote call fails
+ */
+ public final OperationFutureSample code: + * + *
{@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 (SessionServiceClient sessionServiceClient = SessionServiceClient.create()) {
+ * String parent =
+ * ReasoningEngineName.of("[PROJECT]", "[LOCATION]", "[REASONING_ENGINE]").toString();
+ * Session session = Session.newBuilder().build();
+ * Session response = sessionServiceClient.createSessionAsync(parent, session).get();
+ * }
+ * }
+ *
+ * @param parent Required. The resource name of the location to create the session in. Format:
+ * `projects/{project}/locations/{location}/reasoningEngines/{reasoning_engine}`
+ * @param session Required. The session to create.
+ * @throws com.google.api.gax.rpc.ApiException if the remote call fails
+ */
+ public final OperationFutureSample code: + * + *
{@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 (SessionServiceClient sessionServiceClient = SessionServiceClient.create()) {
+ * CreateSessionRequest request =
+ * CreateSessionRequest.newBuilder()
+ * .setParent(
+ * ReasoningEngineName.of("[PROJECT]", "[LOCATION]", "[REASONING_ENGINE]")
+ * .toString())
+ * .setSession(Session.newBuilder().build())
+ * .build();
+ * Session response = sessionServiceClient.createSessionAsync(request).get();
+ * }
+ * }
+ *
+ * @param request The request object containing all of the parameters for the API call.
+ * @throws com.google.api.gax.rpc.ApiException if the remote call fails
+ */
+ public final OperationFutureSample code: + * + *
{@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 (SessionServiceClient sessionServiceClient = SessionServiceClient.create()) {
+ * CreateSessionRequest request =
+ * CreateSessionRequest.newBuilder()
+ * .setParent(
+ * ReasoningEngineName.of("[PROJECT]", "[LOCATION]", "[REASONING_ENGINE]")
+ * .toString())
+ * .setSession(Session.newBuilder().build())
+ * .build();
+ * OperationFuture future =
+ * sessionServiceClient.createSessionOperationCallable().futureCall(request);
+ * // Do something.
+ * Session response = future.get();
+ * }
+ * }
+ */
+ public final OperationCallableSample code: + * + *
{@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 (SessionServiceClient sessionServiceClient = SessionServiceClient.create()) {
+ * CreateSessionRequest request =
+ * CreateSessionRequest.newBuilder()
+ * .setParent(
+ * ReasoningEngineName.of("[PROJECT]", "[LOCATION]", "[REASONING_ENGINE]")
+ * .toString())
+ * .setSession(Session.newBuilder().build())
+ * .build();
+ * ApiFuture future =
+ * sessionServiceClient.createSessionCallable().futureCall(request);
+ * // Do something.
+ * Operation response = future.get();
+ * }
+ * }
+ */
+ public final UnaryCallableSample code: + * + *
{@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 (SessionServiceClient sessionServiceClient = SessionServiceClient.create()) {
+ * SessionName name =
+ * SessionName.of("[PROJECT]", "[LOCATION]", "[REASONING_ENGINE]", "[SESSION]");
+ * Session response = sessionServiceClient.getSession(name);
+ * }
+ * }
+ *
+ * @param name Required. The resource name of the session. Format:
+ * `projects/{project}/locations/{location}/reasoningEngines/{reasoning_engine}/sessions/{session}`
+ * @throws com.google.api.gax.rpc.ApiException if the remote call fails
+ */
+ public final Session getSession(SessionName name) {
+ GetSessionRequest request =
+ GetSessionRequest.newBuilder().setName(name == null ? null : name.toString()).build();
+ return getSession(request);
+ }
+
+ // AUTO-GENERATED DOCUMENTATION AND METHOD.
+ /**
+ * Gets details of the specific [Session][google.cloud.aiplatform.v1.Session].
+ *
+ * Sample code: + * + *
{@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 (SessionServiceClient sessionServiceClient = SessionServiceClient.create()) {
+ * String name =
+ * SessionName.of("[PROJECT]", "[LOCATION]", "[REASONING_ENGINE]", "[SESSION]").toString();
+ * Session response = sessionServiceClient.getSession(name);
+ * }
+ * }
+ *
+ * @param name Required. The resource name of the session. Format:
+ * `projects/{project}/locations/{location}/reasoningEngines/{reasoning_engine}/sessions/{session}`
+ * @throws com.google.api.gax.rpc.ApiException if the remote call fails
+ */
+ public final Session getSession(String name) {
+ GetSessionRequest request = GetSessionRequest.newBuilder().setName(name).build();
+ return getSession(request);
+ }
+
+ // AUTO-GENERATED DOCUMENTATION AND METHOD.
+ /**
+ * Gets details of the specific [Session][google.cloud.aiplatform.v1.Session].
+ *
+ * Sample code: + * + *
{@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 (SessionServiceClient sessionServiceClient = SessionServiceClient.create()) {
+ * GetSessionRequest request =
+ * GetSessionRequest.newBuilder()
+ * .setName(
+ * SessionName.of("[PROJECT]", "[LOCATION]", "[REASONING_ENGINE]", "[SESSION]")
+ * .toString())
+ * .build();
+ * Session response = sessionServiceClient.getSession(request);
+ * }
+ * }
+ *
+ * @param request The request object containing all of the parameters for the API call.
+ * @throws com.google.api.gax.rpc.ApiException if the remote call fails
+ */
+ public final Session getSession(GetSessionRequest request) {
+ return getSessionCallable().call(request);
+ }
+
+ // AUTO-GENERATED DOCUMENTATION AND METHOD.
+ /**
+ * Gets details of the specific [Session][google.cloud.aiplatform.v1.Session].
+ *
+ * Sample code: + * + *
{@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 (SessionServiceClient sessionServiceClient = SessionServiceClient.create()) {
+ * GetSessionRequest request =
+ * GetSessionRequest.newBuilder()
+ * .setName(
+ * SessionName.of("[PROJECT]", "[LOCATION]", "[REASONING_ENGINE]", "[SESSION]")
+ * .toString())
+ * .build();
+ * ApiFuture future = sessionServiceClient.getSessionCallable().futureCall(request);
+ * // Do something.
+ * Session response = future.get();
+ * }
+ * }
+ */
+ public final UnaryCallableSample code: + * + *
{@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 (SessionServiceClient sessionServiceClient = SessionServiceClient.create()) {
+ * ReasoningEngineName parent =
+ * ReasoningEngineName.of("[PROJECT]", "[LOCATION]", "[REASONING_ENGINE]");
+ * for (Session element : sessionServiceClient.listSessions(parent).iterateAll()) {
+ * // doThingsWith(element);
+ * }
+ * }
+ * }
+ *
+ * @param parent Required. The resource name of the location to list sessions from. Format:
+ * `projects/{project}/locations/{location}/reasoningEngines/{reasoning_engine}`
+ * @throws com.google.api.gax.rpc.ApiException if the remote call fails
+ */
+ public final ListSessionsPagedResponse listSessions(ReasoningEngineName parent) {
+ ListSessionsRequest request =
+ ListSessionsRequest.newBuilder()
+ .setParent(parent == null ? null : parent.toString())
+ .build();
+ return listSessions(request);
+ }
+
+ // AUTO-GENERATED DOCUMENTATION AND METHOD.
+ /**
+ * Lists [Sessions][google.cloud.aiplatform.v1.Session] in a given reasoning engine.
+ *
+ * Sample code: + * + *
{@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 (SessionServiceClient sessionServiceClient = SessionServiceClient.create()) {
+ * String parent =
+ * ReasoningEngineName.of("[PROJECT]", "[LOCATION]", "[REASONING_ENGINE]").toString();
+ * for (Session element : sessionServiceClient.listSessions(parent).iterateAll()) {
+ * // doThingsWith(element);
+ * }
+ * }
+ * }
+ *
+ * @param parent Required. The resource name of the location to list sessions from. Format:
+ * `projects/{project}/locations/{location}/reasoningEngines/{reasoning_engine}`
+ * @throws com.google.api.gax.rpc.ApiException if the remote call fails
+ */
+ public final ListSessionsPagedResponse listSessions(String parent) {
+ ListSessionsRequest request = ListSessionsRequest.newBuilder().setParent(parent).build();
+ return listSessions(request);
+ }
+
+ // AUTO-GENERATED DOCUMENTATION AND METHOD.
+ /**
+ * Lists [Sessions][google.cloud.aiplatform.v1.Session] in a given reasoning engine.
+ *
+ * Sample code: + * + *
{@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 (SessionServiceClient sessionServiceClient = SessionServiceClient.create()) {
+ * ListSessionsRequest request =
+ * ListSessionsRequest.newBuilder()
+ * .setParent(
+ * ReasoningEngineName.of("[PROJECT]", "[LOCATION]", "[REASONING_ENGINE]")
+ * .toString())
+ * .setPageSize(883849137)
+ * .setPageToken("pageToken873572522")
+ * .setFilter("filter-1274492040")
+ * .setOrderBy("orderBy-1207110587")
+ * .build();
+ * for (Session element : sessionServiceClient.listSessions(request).iterateAll()) {
+ * // doThingsWith(element);
+ * }
+ * }
+ * }
+ *
+ * @param request The request object containing all of the parameters for the API call.
+ * @throws com.google.api.gax.rpc.ApiException if the remote call fails
+ */
+ public final ListSessionsPagedResponse listSessions(ListSessionsRequest request) {
+ return listSessionsPagedCallable().call(request);
+ }
+
+ // AUTO-GENERATED DOCUMENTATION AND METHOD.
+ /**
+ * Lists [Sessions][google.cloud.aiplatform.v1.Session] in a given reasoning engine.
+ *
+ * Sample code: + * + *
{@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 (SessionServiceClient sessionServiceClient = SessionServiceClient.create()) {
+ * ListSessionsRequest request =
+ * ListSessionsRequest.newBuilder()
+ * .setParent(
+ * ReasoningEngineName.of("[PROJECT]", "[LOCATION]", "[REASONING_ENGINE]")
+ * .toString())
+ * .setPageSize(883849137)
+ * .setPageToken("pageToken873572522")
+ * .setFilter("filter-1274492040")
+ * .setOrderBy("orderBy-1207110587")
+ * .build();
+ * ApiFuture future =
+ * sessionServiceClient.listSessionsPagedCallable().futureCall(request);
+ * // Do something.
+ * for (Session element : future.get().iterateAll()) {
+ * // doThingsWith(element);
+ * }
+ * }
+ * }
+ */
+ public final UnaryCallableSample code: + * + *
{@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 (SessionServiceClient sessionServiceClient = SessionServiceClient.create()) {
+ * ListSessionsRequest request =
+ * ListSessionsRequest.newBuilder()
+ * .setParent(
+ * ReasoningEngineName.of("[PROJECT]", "[LOCATION]", "[REASONING_ENGINE]")
+ * .toString())
+ * .setPageSize(883849137)
+ * .setPageToken("pageToken873572522")
+ * .setFilter("filter-1274492040")
+ * .setOrderBy("orderBy-1207110587")
+ * .build();
+ * while (true) {
+ * ListSessionsResponse response = sessionServiceClient.listSessionsCallable().call(request);
+ * for (Session element : response.getSessionsList()) {
+ * // doThingsWith(element);
+ * }
+ * String nextPageToken = response.getNextPageToken();
+ * if (!Strings.isNullOrEmpty(nextPageToken)) {
+ * request = request.toBuilder().setPageToken(nextPageToken).build();
+ * } else {
+ * break;
+ * }
+ * }
+ * }
+ * }
+ */
+ public final UnaryCallableSample code: + * + *
{@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 (SessionServiceClient sessionServiceClient = SessionServiceClient.create()) {
+ * Session session = Session.newBuilder().build();
+ * FieldMask updateMask = FieldMask.newBuilder().build();
+ * Session response = sessionServiceClient.updateSession(session, updateMask);
+ * }
+ * }
+ *
+ * @param session Required. The session to update. Format:
+ * `projects/{project}/locations/{location}/reasoningEngines/{reasoning_engine}/sessions/{session}`
+ * @param updateMask Optional. Field mask is used to control which fields get updated. If the mask
+ * is not present, all fields will be updated.
+ * @throws com.google.api.gax.rpc.ApiException if the remote call fails
+ */
+ public final Session updateSession(Session session, FieldMask updateMask) {
+ UpdateSessionRequest request =
+ UpdateSessionRequest.newBuilder().setSession(session).setUpdateMask(updateMask).build();
+ return updateSession(request);
+ }
+
+ // AUTO-GENERATED DOCUMENTATION AND METHOD.
+ /**
+ * Updates the specific [Session][google.cloud.aiplatform.v1.Session].
+ *
+ * Sample code: + * + *
{@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 (SessionServiceClient sessionServiceClient = SessionServiceClient.create()) {
+ * UpdateSessionRequest request =
+ * UpdateSessionRequest.newBuilder()
+ * .setSession(Session.newBuilder().build())
+ * .setUpdateMask(FieldMask.newBuilder().build())
+ * .build();
+ * Session response = sessionServiceClient.updateSession(request);
+ * }
+ * }
+ *
+ * @param request The request object containing all of the parameters for the API call.
+ * @throws com.google.api.gax.rpc.ApiException if the remote call fails
+ */
+ public final Session updateSession(UpdateSessionRequest request) {
+ return updateSessionCallable().call(request);
+ }
+
+ // AUTO-GENERATED DOCUMENTATION AND METHOD.
+ /**
+ * Updates the specific [Session][google.cloud.aiplatform.v1.Session].
+ *
+ * Sample code: + * + *
{@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 (SessionServiceClient sessionServiceClient = SessionServiceClient.create()) {
+ * UpdateSessionRequest request =
+ * UpdateSessionRequest.newBuilder()
+ * .setSession(Session.newBuilder().build())
+ * .setUpdateMask(FieldMask.newBuilder().build())
+ * .build();
+ * ApiFuture future = sessionServiceClient.updateSessionCallable().futureCall(request);
+ * // Do something.
+ * Session response = future.get();
+ * }
+ * }
+ */
+ public final UnaryCallableSample code: + * + *
{@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 (SessionServiceClient sessionServiceClient = SessionServiceClient.create()) {
+ * SessionName name =
+ * SessionName.of("[PROJECT]", "[LOCATION]", "[REASONING_ENGINE]", "[SESSION]");
+ * sessionServiceClient.deleteSessionAsync(name).get();
+ * }
+ * }
+ *
+ * @param name Required. The resource name of the session. Format:
+ * `projects/{project}/locations/{location}/reasoningEngines/{reasoning_engine}/sessions/{session}`
+ * @throws com.google.api.gax.rpc.ApiException if the remote call fails
+ */
+ public final OperationFutureSample code: + * + *
{@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 (SessionServiceClient sessionServiceClient = SessionServiceClient.create()) {
+ * String name =
+ * SessionName.of("[PROJECT]", "[LOCATION]", "[REASONING_ENGINE]", "[SESSION]").toString();
+ * sessionServiceClient.deleteSessionAsync(name).get();
+ * }
+ * }
+ *
+ * @param name Required. The resource name of the session. Format:
+ * `projects/{project}/locations/{location}/reasoningEngines/{reasoning_engine}/sessions/{session}`
+ * @throws com.google.api.gax.rpc.ApiException if the remote call fails
+ */
+ public final OperationFutureSample code: + * + *
{@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 (SessionServiceClient sessionServiceClient = SessionServiceClient.create()) {
+ * DeleteSessionRequest request =
+ * DeleteSessionRequest.newBuilder()
+ * .setName(
+ * SessionName.of("[PROJECT]", "[LOCATION]", "[REASONING_ENGINE]", "[SESSION]")
+ * .toString())
+ * .build();
+ * sessionServiceClient.deleteSessionAsync(request).get();
+ * }
+ * }
+ *
+ * @param request The request object containing all of the parameters for the API call.
+ * @throws com.google.api.gax.rpc.ApiException if the remote call fails
+ */
+ public final OperationFutureSample code: + * + *
{@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 (SessionServiceClient sessionServiceClient = SessionServiceClient.create()) {
+ * DeleteSessionRequest request =
+ * DeleteSessionRequest.newBuilder()
+ * .setName(
+ * SessionName.of("[PROJECT]", "[LOCATION]", "[REASONING_ENGINE]", "[SESSION]")
+ * .toString())
+ * .build();
+ * OperationFuture future =
+ * sessionServiceClient.deleteSessionOperationCallable().futureCall(request);
+ * // Do something.
+ * future.get();
+ * }
+ * }
+ */
+ public final OperationCallableSample code: + * + *
{@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 (SessionServiceClient sessionServiceClient = SessionServiceClient.create()) {
+ * DeleteSessionRequest request =
+ * DeleteSessionRequest.newBuilder()
+ * .setName(
+ * SessionName.of("[PROJECT]", "[LOCATION]", "[REASONING_ENGINE]", "[SESSION]")
+ * .toString())
+ * .build();
+ * ApiFuture future =
+ * sessionServiceClient.deleteSessionCallable().futureCall(request);
+ * // Do something.
+ * future.get();
+ * }
+ * }
+ */
+ public final UnaryCallableSample code: + * + *
{@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 (SessionServiceClient sessionServiceClient = SessionServiceClient.create()) {
+ * SessionName parent =
+ * SessionName.of("[PROJECT]", "[LOCATION]", "[REASONING_ENGINE]", "[SESSION]");
+ * for (SessionEvent element : sessionServiceClient.listEvents(parent).iterateAll()) {
+ * // doThingsWith(element);
+ * }
+ * }
+ * }
+ *
+ * @param parent Required. The resource name of the session to list events from. Format:
+ * `projects/{project}/locations/{location}/reasoningEngines/{reasoning_engine}/sessions/{session}`
+ * @throws com.google.api.gax.rpc.ApiException if the remote call fails
+ */
+ public final ListEventsPagedResponse listEvents(SessionName parent) {
+ ListEventsRequest request =
+ ListEventsRequest.newBuilder().setParent(parent == null ? null : parent.toString()).build();
+ return listEvents(request);
+ }
+
+ // AUTO-GENERATED DOCUMENTATION AND METHOD.
+ /**
+ * Lists [Events][google.cloud.aiplatform.v1.Event] in a given session.
+ *
+ * Sample code: + * + *
{@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 (SessionServiceClient sessionServiceClient = SessionServiceClient.create()) {
+ * String parent =
+ * SessionName.of("[PROJECT]", "[LOCATION]", "[REASONING_ENGINE]", "[SESSION]").toString();
+ * for (SessionEvent element : sessionServiceClient.listEvents(parent).iterateAll()) {
+ * // doThingsWith(element);
+ * }
+ * }
+ * }
+ *
+ * @param parent Required. The resource name of the session to list events from. Format:
+ * `projects/{project}/locations/{location}/reasoningEngines/{reasoning_engine}/sessions/{session}`
+ * @throws com.google.api.gax.rpc.ApiException if the remote call fails
+ */
+ public final ListEventsPagedResponse listEvents(String parent) {
+ ListEventsRequest request = ListEventsRequest.newBuilder().setParent(parent).build();
+ return listEvents(request);
+ }
+
+ // AUTO-GENERATED DOCUMENTATION AND METHOD.
+ /**
+ * Lists [Events][google.cloud.aiplatform.v1.Event] in a given session.
+ *
+ * Sample code: + * + *
{@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 (SessionServiceClient sessionServiceClient = SessionServiceClient.create()) {
+ * ListEventsRequest request =
+ * ListEventsRequest.newBuilder()
+ * .setParent(
+ * SessionName.of("[PROJECT]", "[LOCATION]", "[REASONING_ENGINE]", "[SESSION]")
+ * .toString())
+ * .setPageSize(883849137)
+ * .setPageToken("pageToken873572522")
+ * .setFilter("filter-1274492040")
+ * .setOrderBy("orderBy-1207110587")
+ * .build();
+ * for (SessionEvent element : sessionServiceClient.listEvents(request).iterateAll()) {
+ * // doThingsWith(element);
+ * }
+ * }
+ * }
+ *
+ * @param request The request object containing all of the parameters for the API call.
+ * @throws com.google.api.gax.rpc.ApiException if the remote call fails
+ */
+ public final ListEventsPagedResponse listEvents(ListEventsRequest request) {
+ return listEventsPagedCallable().call(request);
+ }
+
+ // AUTO-GENERATED DOCUMENTATION AND METHOD.
+ /**
+ * Lists [Events][google.cloud.aiplatform.v1.Event] in a given session.
+ *
+ * Sample code: + * + *
{@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 (SessionServiceClient sessionServiceClient = SessionServiceClient.create()) {
+ * ListEventsRequest request =
+ * ListEventsRequest.newBuilder()
+ * .setParent(
+ * SessionName.of("[PROJECT]", "[LOCATION]", "[REASONING_ENGINE]", "[SESSION]")
+ * .toString())
+ * .setPageSize(883849137)
+ * .setPageToken("pageToken873572522")
+ * .setFilter("filter-1274492040")
+ * .setOrderBy("orderBy-1207110587")
+ * .build();
+ * ApiFuture future =
+ * sessionServiceClient.listEventsPagedCallable().futureCall(request);
+ * // Do something.
+ * for (SessionEvent element : future.get().iterateAll()) {
+ * // doThingsWith(element);
+ * }
+ * }
+ * }
+ */
+ public final UnaryCallableSample code: + * + *
{@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 (SessionServiceClient sessionServiceClient = SessionServiceClient.create()) {
+ * ListEventsRequest request =
+ * ListEventsRequest.newBuilder()
+ * .setParent(
+ * SessionName.of("[PROJECT]", "[LOCATION]", "[REASONING_ENGINE]", "[SESSION]")
+ * .toString())
+ * .setPageSize(883849137)
+ * .setPageToken("pageToken873572522")
+ * .setFilter("filter-1274492040")
+ * .setOrderBy("orderBy-1207110587")
+ * .build();
+ * while (true) {
+ * ListEventsResponse response = sessionServiceClient.listEventsCallable().call(request);
+ * for (SessionEvent element : response.getSessionEventsList()) {
+ * // doThingsWith(element);
+ * }
+ * String nextPageToken = response.getNextPageToken();
+ * if (!Strings.isNullOrEmpty(nextPageToken)) {
+ * request = request.toBuilder().setPageToken(nextPageToken).build();
+ * } else {
+ * break;
+ * }
+ * }
+ * }
+ * }
+ */
+ public final UnaryCallableSample code: + * + *
{@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 (SessionServiceClient sessionServiceClient = SessionServiceClient.create()) {
+ * SessionName name =
+ * SessionName.of("[PROJECT]", "[LOCATION]", "[REASONING_ENGINE]", "[SESSION]");
+ * SessionEvent event = SessionEvent.newBuilder().build();
+ * AppendEventResponse response = sessionServiceClient.appendEvent(name, event);
+ * }
+ * }
+ *
+ * @param name Required. The resource name of the session to append event to. Format:
+ * `projects/{project}/locations/{location}/reasoningEngines/{reasoning_engine}/sessions/{session}`
+ * @param event Required. The event to append to the session.
+ * @throws com.google.api.gax.rpc.ApiException if the remote call fails
+ */
+ public final AppendEventResponse appendEvent(SessionName name, SessionEvent event) {
+ AppendEventRequest request =
+ AppendEventRequest.newBuilder()
+ .setName(name == null ? null : name.toString())
+ .setEvent(event)
+ .build();
+ return appendEvent(request);
+ }
+
+ // AUTO-GENERATED DOCUMENTATION AND METHOD.
+ /**
+ * Appends an event to a given session.
+ *
+ * Sample code: + * + *
{@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 (SessionServiceClient sessionServiceClient = SessionServiceClient.create()) {
+ * String name =
+ * SessionName.of("[PROJECT]", "[LOCATION]", "[REASONING_ENGINE]", "[SESSION]").toString();
+ * SessionEvent event = SessionEvent.newBuilder().build();
+ * AppendEventResponse response = sessionServiceClient.appendEvent(name, event);
+ * }
+ * }
+ *
+ * @param name Required. The resource name of the session to append event to. Format:
+ * `projects/{project}/locations/{location}/reasoningEngines/{reasoning_engine}/sessions/{session}`
+ * @param event Required. The event to append to the session.
+ * @throws com.google.api.gax.rpc.ApiException if the remote call fails
+ */
+ public final AppendEventResponse appendEvent(String name, SessionEvent event) {
+ AppendEventRequest request =
+ AppendEventRequest.newBuilder().setName(name).setEvent(event).build();
+ return appendEvent(request);
+ }
+
+ // AUTO-GENERATED DOCUMENTATION AND METHOD.
+ /**
+ * Appends an event to a given session.
+ *
+ * Sample code: + * + *
{@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 (SessionServiceClient sessionServiceClient = SessionServiceClient.create()) {
+ * AppendEventRequest request =
+ * AppendEventRequest.newBuilder()
+ * .setName(
+ * SessionName.of("[PROJECT]", "[LOCATION]", "[REASONING_ENGINE]", "[SESSION]")
+ * .toString())
+ * .setEvent(SessionEvent.newBuilder().build())
+ * .build();
+ * AppendEventResponse response = sessionServiceClient.appendEvent(request);
+ * }
+ * }
+ *
+ * @param request The request object containing all of the parameters for the API call.
+ * @throws com.google.api.gax.rpc.ApiException if the remote call fails
+ */
+ public final AppendEventResponse appendEvent(AppendEventRequest request) {
+ return appendEventCallable().call(request);
+ }
+
+ // AUTO-GENERATED DOCUMENTATION AND METHOD.
+ /**
+ * Appends an event to a given session.
+ *
+ * Sample code: + * + *
{@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 (SessionServiceClient sessionServiceClient = SessionServiceClient.create()) {
+ * AppendEventRequest request =
+ * AppendEventRequest.newBuilder()
+ * .setName(
+ * SessionName.of("[PROJECT]", "[LOCATION]", "[REASONING_ENGINE]", "[SESSION]")
+ * .toString())
+ * .setEvent(SessionEvent.newBuilder().build())
+ * .build();
+ * ApiFuture future =
+ * sessionServiceClient.appendEventCallable().futureCall(request);
+ * // Do something.
+ * AppendEventResponse response = future.get();
+ * }
+ * }
+ */
+ public final UnaryCallableSample code: + * + *
{@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 (SessionServiceClient sessionServiceClient = SessionServiceClient.create()) {
+ * ListLocationsRequest request =
+ * ListLocationsRequest.newBuilder()
+ * .setName("name3373707")
+ * .setFilter("filter-1274492040")
+ * .setPageSize(883849137)
+ * .setPageToken("pageToken873572522")
+ * .build();
+ * for (Location element : sessionServiceClient.listLocations(request).iterateAll()) {
+ * // doThingsWith(element);
+ * }
+ * }
+ * }
+ *
+ * @param request The request object containing all of the parameters for the API call.
+ * @throws com.google.api.gax.rpc.ApiException if the remote call fails
+ */
+ public final ListLocationsPagedResponse listLocations(ListLocationsRequest request) {
+ return listLocationsPagedCallable().call(request);
+ }
+
+ // AUTO-GENERATED DOCUMENTATION AND METHOD.
+ /**
+ * Lists information about the supported locations for this service.
+ *
+ * Sample code: + * + *
{@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 (SessionServiceClient sessionServiceClient = SessionServiceClient.create()) {
+ * ListLocationsRequest request =
+ * ListLocationsRequest.newBuilder()
+ * .setName("name3373707")
+ * .setFilter("filter-1274492040")
+ * .setPageSize(883849137)
+ * .setPageToken("pageToken873572522")
+ * .build();
+ * ApiFuture future =
+ * sessionServiceClient.listLocationsPagedCallable().futureCall(request);
+ * // Do something.
+ * for (Location element : future.get().iterateAll()) {
+ * // doThingsWith(element);
+ * }
+ * }
+ * }
+ */
+ public final UnaryCallableSample code: + * + *
{@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 (SessionServiceClient sessionServiceClient = SessionServiceClient.create()) {
+ * ListLocationsRequest request =
+ * ListLocationsRequest.newBuilder()
+ * .setName("name3373707")
+ * .setFilter("filter-1274492040")
+ * .setPageSize(883849137)
+ * .setPageToken("pageToken873572522")
+ * .build();
+ * while (true) {
+ * ListLocationsResponse response = sessionServiceClient.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 UnaryCallableSample code: + * + *
{@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 (SessionServiceClient sessionServiceClient = SessionServiceClient.create()) {
+ * GetLocationRequest request = GetLocationRequest.newBuilder().setName("name3373707").build();
+ * Location response = sessionServiceClient.getLocation(request);
+ * }
+ * }
+ *
+ * @param request The request object containing all of the parameters for the API call.
+ * @throws com.google.api.gax.rpc.ApiException if the remote call fails
+ */
+ public final Location getLocation(GetLocationRequest request) {
+ return getLocationCallable().call(request);
+ }
+
+ // AUTO-GENERATED DOCUMENTATION AND METHOD.
+ /**
+ * Gets information about a location.
+ *
+ * Sample code: + * + *
{@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 (SessionServiceClient sessionServiceClient = SessionServiceClient.create()) {
+ * GetLocationRequest request = GetLocationRequest.newBuilder().setName("name3373707").build();
+ * ApiFuture future = sessionServiceClient.getLocationCallable().futureCall(request);
+ * // Do something.
+ * Location response = future.get();
+ * }
+ * }
+ */
+ public final UnaryCallableCan return `NOT_FOUND`, `INVALID_ARGUMENT`, and `PERMISSION_DENIED`errors. + * + *
Sample code: + * + *
{@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 (SessionServiceClient sessionServiceClient = SessionServiceClient.create()) {
+ * SetIamPolicyRequest request =
+ * SetIamPolicyRequest.newBuilder()
+ * .setResource(
+ * EndpointName.ofProjectLocationEndpointName(
+ * "[PROJECT]", "[LOCATION]", "[ENDPOINT]")
+ * .toString())
+ * .setPolicy(Policy.newBuilder().build())
+ * .setUpdateMask(FieldMask.newBuilder().build())
+ * .build();
+ * Policy response = sessionServiceClient.setIamPolicy(request);
+ * }
+ * }
+ *
+ * @param request The request object containing all of the parameters for the API call.
+ * @throws com.google.api.gax.rpc.ApiException if the remote call fails
+ */
+ public final Policy setIamPolicy(SetIamPolicyRequest request) {
+ return setIamPolicyCallable().call(request);
+ }
+
+ // AUTO-GENERATED DOCUMENTATION AND METHOD.
+ /**
+ * Sets the access control policy on the specified resource. Replacesany existing policy.
+ *
+ * Can return `NOT_FOUND`, `INVALID_ARGUMENT`, and `PERMISSION_DENIED`errors. + * + *
Sample code: + * + *
{@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 (SessionServiceClient sessionServiceClient = SessionServiceClient.create()) {
+ * SetIamPolicyRequest request =
+ * SetIamPolicyRequest.newBuilder()
+ * .setResource(
+ * EndpointName.ofProjectLocationEndpointName(
+ * "[PROJECT]", "[LOCATION]", "[ENDPOINT]")
+ * .toString())
+ * .setPolicy(Policy.newBuilder().build())
+ * .setUpdateMask(FieldMask.newBuilder().build())
+ * .build();
+ * ApiFuture future = sessionServiceClient.setIamPolicyCallable().futureCall(request);
+ * // Do something.
+ * Policy response = future.get();
+ * }
+ * }
+ */
+ public final UnaryCallableSample code: + * + *
{@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 (SessionServiceClient sessionServiceClient = SessionServiceClient.create()) {
+ * GetIamPolicyRequest request =
+ * GetIamPolicyRequest.newBuilder()
+ * .setResource(
+ * EndpointName.ofProjectLocationEndpointName(
+ * "[PROJECT]", "[LOCATION]", "[ENDPOINT]")
+ * .toString())
+ * .setOptions(GetPolicyOptions.newBuilder().build())
+ * .build();
+ * Policy response = sessionServiceClient.getIamPolicy(request);
+ * }
+ * }
+ *
+ * @param request The request object containing all of the parameters for the API call.
+ * @throws com.google.api.gax.rpc.ApiException if the remote call fails
+ */
+ public final Policy getIamPolicy(GetIamPolicyRequest request) {
+ return getIamPolicyCallable().call(request);
+ }
+
+ // AUTO-GENERATED DOCUMENTATION AND METHOD.
+ /**
+ * Gets the access control policy for a resource. Returns an empty policyif the resource exists
+ * and does not have a policy set.
+ *
+ * Sample code: + * + *
{@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 (SessionServiceClient sessionServiceClient = SessionServiceClient.create()) {
+ * GetIamPolicyRequest request =
+ * GetIamPolicyRequest.newBuilder()
+ * .setResource(
+ * EndpointName.ofProjectLocationEndpointName(
+ * "[PROJECT]", "[LOCATION]", "[ENDPOINT]")
+ * .toString())
+ * .setOptions(GetPolicyOptions.newBuilder().build())
+ * .build();
+ * ApiFuture future = sessionServiceClient.getIamPolicyCallable().futureCall(request);
+ * // Do something.
+ * Policy response = future.get();
+ * }
+ * }
+ */
+ public final UnaryCallableNote: This operation is designed to be used for buildingpermission-aware UIs and + * command-line tools, not for authorizationchecking. This operation may "fail open" without + * warning. + * + *
Sample code: + * + *
{@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 (SessionServiceClient sessionServiceClient = SessionServiceClient.create()) {
+ * TestIamPermissionsRequest request =
+ * TestIamPermissionsRequest.newBuilder()
+ * .setResource(
+ * EndpointName.ofProjectLocationEndpointName(
+ * "[PROJECT]", "[LOCATION]", "[ENDPOINT]")
+ * .toString())
+ * .addAllPermissions(new ArrayList())
+ * .build();
+ * TestIamPermissionsResponse response = sessionServiceClient.testIamPermissions(request);
+ * }
+ * }
+ *
+ * @param request The request object containing all of the parameters for the API call.
+ * @throws com.google.api.gax.rpc.ApiException if the remote call fails
+ */
+ public final TestIamPermissionsResponse testIamPermissions(TestIamPermissionsRequest request) {
+ return testIamPermissionsCallable().call(request);
+ }
+
+ // AUTO-GENERATED DOCUMENTATION AND METHOD.
+ /**
+ * Returns permissions that a caller has on the specified resource. If theresource does not exist,
+ * this will return an empty set ofpermissions, not a `NOT_FOUND` error.
+ *
+ * Note: This operation is designed to be used for buildingpermission-aware UIs and + * command-line tools, not for authorizationchecking. This operation may "fail open" without + * warning. + * + *
Sample code: + * + *
{@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 (SessionServiceClient sessionServiceClient = SessionServiceClient.create()) {
+ * TestIamPermissionsRequest request =
+ * TestIamPermissionsRequest.newBuilder()
+ * .setResource(
+ * EndpointName.ofProjectLocationEndpointName(
+ * "[PROJECT]", "[LOCATION]", "[ENDPOINT]")
+ * .toString())
+ * .addAllPermissions(new ArrayList())
+ * .build();
+ * ApiFuture future =
+ * sessionServiceClient.testIamPermissionsCallable().futureCall(request);
+ * // Do something.
+ * TestIamPermissionsResponse response = future.get();
+ * }
+ * }
+ */
+ public final UnaryCallableThe default instance has everything set to sensible defaults: + * + *
The builder of this class is recursive, so contained classes are themselves builders. When + * build() is called, the tree of builders is called to create the complete settings object. + * + *
For example, to set the + * [RetrySettings](https://cloud.google.com/java/docs/reference/gax/latest/com.google.api.gax.retrying.RetrySettings) + * of getSession: + * + *
{@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
+ * SessionServiceSettings.Builder sessionServiceSettingsBuilder =
+ * SessionServiceSettings.newBuilder();
+ * sessionServiceSettingsBuilder
+ * .getSessionSettings()
+ * .setRetrySettings(
+ * sessionServiceSettingsBuilder
+ * .getSessionSettings()
+ * .getRetrySettings()
+ * .toBuilder()
+ * .setInitialRetryDelayDuration(Duration.ofSeconds(1))
+ * .setInitialRpcTimeoutDuration(Duration.ofSeconds(5))
+ * .setMaxAttempts(5)
+ * .setMaxRetryDelayDuration(Duration.ofSeconds(30))
+ * .setMaxRpcTimeoutDuration(Duration.ofSeconds(60))
+ * .setRetryDelayMultiplier(1.3)
+ * .setRpcTimeoutMultiplier(1.5)
+ * .setTotalTimeoutDuration(Duration.ofSeconds(300))
+ * .build());
+ * SessionServiceSettings sessionServiceSettings = sessionServiceSettingsBuilder.build();
+ * }
+ *
+ * Please refer to the [Client Side Retry
+ * Guide](https://docs.cloud.google.com/java/docs/client-retries) for additional support in setting
+ * retries.
+ *
+ * To configure the RetrySettings of a Long Running Operation method, create an + * OperationTimedPollAlgorithm object and update the RPC's polling algorithm. For example, to + * configure the RetrySettings for createSession: + * + *
{@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
+ * SessionServiceSettings.Builder sessionServiceSettingsBuilder =
+ * SessionServiceSettings.newBuilder();
+ * TimedRetryAlgorithm timedRetryAlgorithm =
+ * OperationalTimedPollAlgorithm.create(
+ * RetrySettings.newBuilder()
+ * .setInitialRetryDelayDuration(Duration.ofMillis(500))
+ * .setRetryDelayMultiplier(1.5)
+ * .setMaxRetryDelayDuration(Duration.ofMillis(5000))
+ * .setTotalTimeoutDuration(Duration.ofHours(24))
+ * .build());
+ * sessionServiceSettingsBuilder
+ * .createClusterOperationSettings()
+ * .setPollingAlgorithm(timedRetryAlgorithm)
+ * .build();
+ * }
+ */
+@Generated("by gapic-generator-java")
+public class SessionServiceSettings extends ClientSettingsNote: This method does not support applying settings to streaming methods.
+ */
+ public Builder applyToAllUnaryMethods(
+ ApiFunction ======================= SessionServiceClient =======================
+ *
+ * Service Description: The service that manages Vertex Session related resources.
+ *
+ * Sample for SessionServiceClient:
+ *
+ * ======================= SpecialistPoolServiceClient =======================
*
* Service Description: A service for creating and managing Customer SpecialistPools. When
diff --git a/java-aiplatform/google-cloud-aiplatform/src/main/java/com/google/cloud/aiplatform/v1/stub/GrpcSessionServiceCallableFactory.java b/java-aiplatform/google-cloud-aiplatform/src/main/java/com/google/cloud/aiplatform/v1/stub/GrpcSessionServiceCallableFactory.java
new file mode 100644
index 000000000000..7cf27919536a
--- /dev/null
+++ b/java-aiplatform/google-cloud-aiplatform/src/main/java/com/google/cloud/aiplatform/v1/stub/GrpcSessionServiceCallableFactory.java
@@ -0,0 +1,113 @@
+/*
+ * Copyright 2026 Google LLC
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * https://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.google.cloud.aiplatform.v1.stub;
+
+import com.google.api.gax.grpc.GrpcCallSettings;
+import com.google.api.gax.grpc.GrpcCallableFactory;
+import com.google.api.gax.grpc.GrpcStubCallableFactory;
+import com.google.api.gax.rpc.BatchingCallSettings;
+import com.google.api.gax.rpc.BidiStreamingCallable;
+import com.google.api.gax.rpc.ClientContext;
+import com.google.api.gax.rpc.ClientStreamingCallable;
+import com.google.api.gax.rpc.OperationCallSettings;
+import com.google.api.gax.rpc.OperationCallable;
+import com.google.api.gax.rpc.PagedCallSettings;
+import com.google.api.gax.rpc.ServerStreamingCallSettings;
+import com.google.api.gax.rpc.ServerStreamingCallable;
+import com.google.api.gax.rpc.StreamingCallSettings;
+import com.google.api.gax.rpc.UnaryCallSettings;
+import com.google.api.gax.rpc.UnaryCallable;
+import com.google.longrunning.Operation;
+import com.google.longrunning.stub.OperationsStub;
+import javax.annotation.Generated;
+
+// AUTO-GENERATED DOCUMENTATION AND CLASS.
+/**
+ * gRPC callable factory implementation for the SessionService service API.
+ *
+ * This class is for advanced usage.
+ */
+@Generated("by gapic-generator-java")
+public class GrpcSessionServiceCallableFactory implements GrpcStubCallableFactory {
+
+ @Override
+ public This class is for advanced usage and reflects the underlying API directly.
+ */
+@Generated("by gapic-generator-java")
+public class GrpcSessionServiceStub extends SessionServiceStub {
+ private static final MethodDescriptor This class is for advanced usage and reflects the underlying API directly.
+ */
+@Generated("by gapic-generator-java")
+public abstract class SessionServiceStub implements BackgroundResource {
+
+ public OperationsStub getOperationsStub() {
+ throw new UnsupportedOperationException("Not implemented: getOperationsStub()");
+ }
+
+ public OperationCallable The default instance has everything set to sensible defaults:
+ *
+ * The builder of this class is recursive, so contained classes are themselves builders. When
+ * build() is called, the tree of builders is called to create the complete settings object.
+ *
+ * For example, to set the
+ * [RetrySettings](https://cloud.google.com/java/docs/reference/gax/latest/com.google.api.gax.retrying.RetrySettings)
+ * of getSession:
+ *
+ * To configure the RetrySettings of a Long Running Operation method, create an
+ * OperationTimedPollAlgorithm object and update the RPC's polling algorithm. For example, to
+ * configure the RetrySettings for createSession:
+ *
+ * {@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 (SessionServiceClient sessionServiceClient = SessionServiceClient.create()) {
+ * SessionName name =
+ * SessionName.of("[PROJECT]", "[LOCATION]", "[REASONING_ENGINE]", "[SESSION]");
+ * Session response = sessionServiceClient.getSession(name);
+ * }
+ * }
+ *
*
+ *
+ *
+ * {@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
+ * SessionServiceStubSettings.Builder sessionServiceSettingsBuilder =
+ * SessionServiceStubSettings.newBuilder();
+ * sessionServiceSettingsBuilder
+ * .getSessionSettings()
+ * .setRetrySettings(
+ * sessionServiceSettingsBuilder
+ * .getSessionSettings()
+ * .getRetrySettings()
+ * .toBuilder()
+ * .setInitialRetryDelayDuration(Duration.ofSeconds(1))
+ * .setInitialRpcTimeoutDuration(Duration.ofSeconds(5))
+ * .setMaxAttempts(5)
+ * .setMaxRetryDelayDuration(Duration.ofSeconds(30))
+ * .setMaxRpcTimeoutDuration(Duration.ofSeconds(60))
+ * .setRetryDelayMultiplier(1.3)
+ * .setRpcTimeoutMultiplier(1.5)
+ * .setTotalTimeoutDuration(Duration.ofSeconds(300))
+ * .build());
+ * SessionServiceStubSettings sessionServiceSettings = sessionServiceSettingsBuilder.build();
+ * }
+ *
+ * Please refer to the [Client Side Retry
+ * Guide](https://docs.cloud.google.com/java/docs/client-retries) for additional support in setting
+ * retries.
+ *
+ * {@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
+ * SessionServiceStubSettings.Builder sessionServiceSettingsBuilder =
+ * SessionServiceStubSettings.newBuilder();
+ * TimedRetryAlgorithm timedRetryAlgorithm =
+ * OperationalTimedPollAlgorithm.create(
+ * RetrySettings.newBuilder()
+ * .setInitialRetryDelayDuration(Duration.ofMillis(500))
+ * .setRetryDelayMultiplier(1.5)
+ * .setMaxRetryDelayDuration(Duration.ofMillis(5000))
+ * .setTotalTimeoutDuration(Duration.ofHours(24))
+ * .build());
+ * sessionServiceSettingsBuilder
+ * .createClusterOperationSettings()
+ * .setPollingAlgorithm(timedRetryAlgorithm)
+ * .build();
+ * }
+ */
+@Generated("by gapic-generator-java")
+public class SessionServiceStubSettings extends StubSettings