Class MemoryBankServiceClient

java.lang.Object
com.google.cloud.aiplatform.v1beta1.MemoryBankServiceClient
All Implemented Interfaces:
BackgroundResource, AutoCloseable

@BetaApi @Generated("by gapic-generator-java") public class MemoryBankServiceClient extends Object implements BackgroundResource
Service Description: A service for managing memories for LLM applications.

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 (MemoryBankServiceClient memoryBankServiceClient = MemoryBankServiceClient.create()) {
   MemoryName name = MemoryName.of("[PROJECT]", "[LOCATION]", "[REASONING_ENGINE]", "[MEMORY]");
   Memory response = memoryBankServiceClient.getMemory(name);
 }
 

Note: close() needs to be called on the MemoryBankServiceClient object to clean up resources such as threads. In the example above, try-with-resources is used, which automatically calls close().

Methods
Method Description Method Variants

CreateMemory

Create a Memory.

Request object method variants only take one parameter, a request object, which must be constructed before the call.

  • createMemoryAsync(CreateMemoryRequest request)

Methods that return long-running operations have "Async" method variants that return `OperationFuture`, which is used to track polling of the service.

  • createMemoryAsync(ReasoningEngineName parent, Memory memory, String memoryId)

  • createMemoryAsync(String parent, Memory memory, String memoryId)

Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.

  • createMemoryOperationCallable()

  • createMemoryCallable()

GetMemory

Get a Memory.

Request object method variants only take one parameter, a request object, which must be constructed before the call.

  • getMemory(GetMemoryRequest request)

"Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method.

  • getMemory(MemoryName name)

  • getMemory(String name)

Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.

  • getMemoryCallable()

UpdateMemory

Update a Memory.

Request object method variants only take one parameter, a request object, which must be constructed before the call.

  • updateMemoryAsync(UpdateMemoryRequest request)

Methods that return long-running operations have "Async" method variants that return `OperationFuture`, which is used to track polling of the service.

  • updateMemoryAsync(Memory memory, FieldMask updateMask)

Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.

  • updateMemoryOperationCallable()

  • updateMemoryCallable()

ListMemories

List Memories.

Request object method variants only take one parameter, a request object, which must be constructed before the call.

  • listMemories(ListMemoriesRequest request)

"Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method.

  • listMemories(ReasoningEngineName parent)

  • listMemories(String parent)

Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.

  • listMemoriesPagedCallable()

  • listMemoriesCallable()

DeleteMemory

Delete a Memory.

Request object method variants only take one parameter, a request object, which must be constructed before the call.

  • deleteMemoryAsync(DeleteMemoryRequest request)

Methods that return long-running operations have "Async" method variants that return `OperationFuture`, which is used to track polling of the service.

  • deleteMemoryAsync(MemoryName name)

  • deleteMemoryAsync(String name)

Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.

  • deleteMemoryOperationCallable()

  • deleteMemoryCallable()

GenerateMemories

Generate memories.

Request object method variants only take one parameter, a request object, which must be constructed before the call.

  • generateMemoriesAsync(GenerateMemoriesRequest request)

Methods that return long-running operations have "Async" method variants that return `OperationFuture`, which is used to track polling of the service.

  • generateMemoriesAsync(ReasoningEngineName parent)

  • generateMemoriesAsync(String parent)

Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.

  • generateMemoriesOperationCallable()

  • generateMemoriesCallable()

RetrieveMemories

Retrieve memories.

Request object method variants only take one parameter, a request object, which must be constructed before the call.

  • retrieveMemories(RetrieveMemoriesRequest request)

"Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method.

  • retrieveMemories(ReasoningEngineName parent)

  • retrieveMemories(String parent)

Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.

  • retrieveMemoriesCallable()

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.

  • listLocations(ListLocationsRequest request)

Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.

  • listLocationsPagedCallable()

  • listLocationsCallable()

GetLocation

Gets information about a location.

Request object method variants only take one parameter, a request object, which must be constructed before the call.

  • getLocation(GetLocationRequest request)

Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.

  • getLocationCallable()

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.

  • setIamPolicy(SetIamPolicyRequest request)

Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.

  • setIamPolicyCallable()

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.

  • getIamPolicy(GetIamPolicyRequest request)

Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.

  • getIamPolicyCallable()

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.

  • testIamPermissions(TestIamPermissionsRequest request)

Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.

  • testIamPermissionsCallable()

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 MemoryBankServiceSettings 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
 MemoryBankServiceSettings memoryBankServiceSettings =
     MemoryBankServiceSettings.newBuilder()
         .setCredentialsProvider(FixedCredentialsProvider.create(myCredentials))
         .build();
 MemoryBankServiceClient memoryBankServiceClient =
     MemoryBankServiceClient.create(memoryBankServiceSettings);
 

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
 MemoryBankServiceSettings memoryBankServiceSettings =
     MemoryBankServiceSettings.newBuilder().setEndpoint(myEndpoint).build();
 MemoryBankServiceClient memoryBankServiceClient =
     MemoryBankServiceClient.create(memoryBankServiceSettings);
 

Please refer to the GitHub repository's samples for more quickstart code snippets.

  • Constructor Details

    • MemoryBankServiceClient

      protected MemoryBankServiceClient(MemoryBankServiceSettings settings) throws IOException
      Constructs an instance of MemoryBankServiceClient, 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.
      Throws:
      IOException
    • MemoryBankServiceClient

      protected MemoryBankServiceClient(MemoryBankServiceStub stub)
  • Method Details

    • create

      public static final MemoryBankServiceClient create() throws IOException
      Constructs an instance of MemoryBankServiceClient with default settings.
      Throws:
      IOException
    • create

      public static final MemoryBankServiceClient create(MemoryBankServiceSettings settings) throws IOException
      Constructs an instance of MemoryBankServiceClient, using the given settings. The channels are created based on the settings passed in, or defaults for any settings that are not set.
      Throws:
      IOException
    • create

      public static final MemoryBankServiceClient create(MemoryBankServiceStub stub)
      Constructs an instance of MemoryBankServiceClient, using the given stub for making calls. This is for advanced usage - prefer using create(MemoryBankServiceSettings).
    • getSettings

      public final MemoryBankServiceSettings getSettings()
    • getStub

      public MemoryBankServiceStub getStub()
    • getOperationsClient

      public final OperationsClient getOperationsClient()
      Returns the OperationsClient that can be used to query the status of a long-running operation returned by another API method call.
    • createMemoryAsync

      public final OperationFuture<Memory,CreateMemoryOperationMetadata> createMemoryAsync(ReasoningEngineName parent, Memory memory, String memoryId)
      Create a Memory.

      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 (MemoryBankServiceClient memoryBankServiceClient = MemoryBankServiceClient.create()) {
         ReasoningEngineName parent =
             ReasoningEngineName.of("[PROJECT]", "[LOCATION]", "[REASONING_ENGINE]");
         Memory memory = Memory.newBuilder().build();
         String memoryId = "memoryId-637040132";
         Memory response = memoryBankServiceClient.createMemoryAsync(parent, memory, memoryId).get();
       }
       
      Parameters:
      parent - Required. The resource name of the ReasoningEngine to create the Memory under. Format: `projects/{project}/locations/{location}/reasoningEngines/{reasoning_engine}`
      memory - Required. The Memory to be created.
      memoryId - Optional. The user defined ID to use for memory, which will become the final component of the memory resource name. If not provided, Vertex AI will generate a value for this ID.

      This value may be up to 63 characters, and valid characters are `[a-z0-9-]`. The first character must be a letter, and the last character must be a letter or number.

      Throws:
      ApiException - if the remote call fails
    • createMemoryAsync

      public final OperationFuture<Memory,CreateMemoryOperationMetadata> createMemoryAsync(String parent, Memory memory, String memoryId)
      Create a Memory.

      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 (MemoryBankServiceClient memoryBankServiceClient = MemoryBankServiceClient.create()) {
         String parent =
             ReasoningEngineName.of("[PROJECT]", "[LOCATION]", "[REASONING_ENGINE]").toString();
         Memory memory = Memory.newBuilder().build();
         String memoryId = "memoryId-637040132";
         Memory response = memoryBankServiceClient.createMemoryAsync(parent, memory, memoryId).get();
       }
       
      Parameters:
      parent - Required. The resource name of the ReasoningEngine to create the Memory under. Format: `projects/{project}/locations/{location}/reasoningEngines/{reasoning_engine}`
      memory - Required. The Memory to be created.
      memoryId - Optional. The user defined ID to use for memory, which will become the final component of the memory resource name. If not provided, Vertex AI will generate a value for this ID.

      This value may be up to 63 characters, and valid characters are `[a-z0-9-]`. The first character must be a letter, and the last character must be a letter or number.

      Throws:
      ApiException - if the remote call fails
    • createMemoryAsync

      public final OperationFuture<Memory,CreateMemoryOperationMetadata> createMemoryAsync(CreateMemoryRequest request)
      Create a Memory.

      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 (MemoryBankServiceClient memoryBankServiceClient = MemoryBankServiceClient.create()) {
         CreateMemoryRequest request =
             CreateMemoryRequest.newBuilder()
                 .setParent(
                     ReasoningEngineName.of("[PROJECT]", "[LOCATION]", "[REASONING_ENGINE]")
                         .toString())
                 .setMemory(Memory.newBuilder().build())
                 .setMemoryId("memoryId-637040132")
                 .build();
         Memory response = memoryBankServiceClient.createMemoryAsync(request).get();
       }
       
      Parameters:
      request - The request object containing all of the parameters for the API call.
      Throws:
      ApiException - if the remote call fails
    • createMemoryOperationCallable

      public final OperationCallable<CreateMemoryRequest,Memory,CreateMemoryOperationMetadata> createMemoryOperationCallable()
      Create a Memory.

      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 (MemoryBankServiceClient memoryBankServiceClient = MemoryBankServiceClient.create()) {
         CreateMemoryRequest request =
             CreateMemoryRequest.newBuilder()
                 .setParent(
                     ReasoningEngineName.of("[PROJECT]", "[LOCATION]", "[REASONING_ENGINE]")
                         .toString())
                 .setMemory(Memory.newBuilder().build())
                 .setMemoryId("memoryId-637040132")
                 .build();
         OperationFuture<Memory, CreateMemoryOperationMetadata> future =
             memoryBankServiceClient.createMemoryOperationCallable().futureCall(request);
         // Do something.
         Memory response = future.get();
       }
       
    • createMemoryCallable

      public final UnaryCallable<CreateMemoryRequest,Operation> createMemoryCallable()
      Create a Memory.

      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 (MemoryBankServiceClient memoryBankServiceClient = MemoryBankServiceClient.create()) {
         CreateMemoryRequest request =
             CreateMemoryRequest.newBuilder()
                 .setParent(
                     ReasoningEngineName.of("[PROJECT]", "[LOCATION]", "[REASONING_ENGINE]")
                         .toString())
                 .setMemory(Memory.newBuilder().build())
                 .setMemoryId("memoryId-637040132")
                 .build();
         ApiFuture<Operation> future =
             memoryBankServiceClient.createMemoryCallable().futureCall(request);
         // Do something.
         Operation response = future.get();
       }
       
    • getMemory

      public final Memory getMemory(MemoryName name)
      Get a Memory.

      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 (MemoryBankServiceClient memoryBankServiceClient = MemoryBankServiceClient.create()) {
         MemoryName name = MemoryName.of("[PROJECT]", "[LOCATION]", "[REASONING_ENGINE]", "[MEMORY]");
         Memory response = memoryBankServiceClient.getMemory(name);
       }
       
      Parameters:
      name - Required. The resource name of the Memory. Format: `projects/{project}/locations/{location}/reasoningEngines/{reasoning_engine}/memories/{memory}`
      Throws:
      ApiException - if the remote call fails
    • getMemory

      public final Memory getMemory(String name)
      Get a Memory.

      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 (MemoryBankServiceClient memoryBankServiceClient = MemoryBankServiceClient.create()) {
         String name =
             MemoryName.of("[PROJECT]", "[LOCATION]", "[REASONING_ENGINE]", "[MEMORY]").toString();
         Memory response = memoryBankServiceClient.getMemory(name);
       }
       
      Parameters:
      name - Required. The resource name of the Memory. Format: `projects/{project}/locations/{location}/reasoningEngines/{reasoning_engine}/memories/{memory}`
      Throws:
      ApiException - if the remote call fails
    • getMemory

      public final Memory getMemory(GetMemoryRequest request)
      Get a Memory.

      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 (MemoryBankServiceClient memoryBankServiceClient = MemoryBankServiceClient.create()) {
         GetMemoryRequest request =
             GetMemoryRequest.newBuilder()
                 .setName(
                     MemoryName.of("[PROJECT]", "[LOCATION]", "[REASONING_ENGINE]", "[MEMORY]")
                         .toString())
                 .build();
         Memory response = memoryBankServiceClient.getMemory(request);
       }
       
      Parameters:
      request - The request object containing all of the parameters for the API call.
      Throws:
      ApiException - if the remote call fails
    • getMemoryCallable

      public final UnaryCallable<GetMemoryRequest,Memory> getMemoryCallable()
      Get a Memory.

      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 (MemoryBankServiceClient memoryBankServiceClient = MemoryBankServiceClient.create()) {
         GetMemoryRequest request =
             GetMemoryRequest.newBuilder()
                 .setName(
                     MemoryName.of("[PROJECT]", "[LOCATION]", "[REASONING_ENGINE]", "[MEMORY]")
                         .toString())
                 .build();
         ApiFuture<Memory> future = memoryBankServiceClient.getMemoryCallable().futureCall(request);
         // Do something.
         Memory response = future.get();
       }
       
    • updateMemoryAsync

      public final OperationFuture<Memory,UpdateMemoryOperationMetadata> updateMemoryAsync(Memory memory, com.google.protobuf.FieldMask updateMask)
      Update a Memory.

      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 (MemoryBankServiceClient memoryBankServiceClient = MemoryBankServiceClient.create()) {
         Memory memory = Memory.newBuilder().build();
         FieldMask updateMask = FieldMask.newBuilder().build();
         Memory response = memoryBankServiceClient.updateMemoryAsync(memory, updateMask).get();
       }
       
      Parameters:
      memory - Required. The Memory which replaces the resource on the server.
      updateMask - Optional. Mask specifying which fields to update. Supported fields:

      * `display_name` * `description` * `fact`

      Throws:
      ApiException - if the remote call fails
    • updateMemoryAsync

      public final OperationFuture<Memory,UpdateMemoryOperationMetadata> updateMemoryAsync(UpdateMemoryRequest request)
      Update a Memory.

      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 (MemoryBankServiceClient memoryBankServiceClient = MemoryBankServiceClient.create()) {
         UpdateMemoryRequest request =
             UpdateMemoryRequest.newBuilder()
                 .setMemory(Memory.newBuilder().build())
                 .setUpdateMask(FieldMask.newBuilder().build())
                 .build();
         Memory response = memoryBankServiceClient.updateMemoryAsync(request).get();
       }
       
      Parameters:
      request - The request object containing all of the parameters for the API call.
      Throws:
      ApiException - if the remote call fails
    • updateMemoryOperationCallable

      public final OperationCallable<UpdateMemoryRequest,Memory,UpdateMemoryOperationMetadata> updateMemoryOperationCallable()
      Update a Memory.

      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 (MemoryBankServiceClient memoryBankServiceClient = MemoryBankServiceClient.create()) {
         UpdateMemoryRequest request =
             UpdateMemoryRequest.newBuilder()
                 .setMemory(Memory.newBuilder().build())
                 .setUpdateMask(FieldMask.newBuilder().build())
                 .build();
         OperationFuture<Memory, UpdateMemoryOperationMetadata> future =
             memoryBankServiceClient.updateMemoryOperationCallable().futureCall(request);
         // Do something.
         Memory response = future.get();
       }
       
    • updateMemoryCallable

      public final UnaryCallable<UpdateMemoryRequest,Operation> updateMemoryCallable()
      Update a Memory.

      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 (MemoryBankServiceClient memoryBankServiceClient = MemoryBankServiceClient.create()) {
         UpdateMemoryRequest request =
             UpdateMemoryRequest.newBuilder()
                 .setMemory(Memory.newBuilder().build())
                 .setUpdateMask(FieldMask.newBuilder().build())
                 .build();
         ApiFuture<Operation> future =
             memoryBankServiceClient.updateMemoryCallable().futureCall(request);
         // Do something.
         Operation response = future.get();
       }
       
    • listMemories

      List Memories.

      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 (MemoryBankServiceClient memoryBankServiceClient = MemoryBankServiceClient.create()) {
         ReasoningEngineName parent =
             ReasoningEngineName.of("[PROJECT]", "[LOCATION]", "[REASONING_ENGINE]");
         for (Memory element : memoryBankServiceClient.listMemories(parent).iterateAll()) {
           // doThingsWith(element);
         }
       }
       
      Parameters:
      parent - Required. The resource name of the ReasoningEngine to list the Memories under. Format: `projects/{project}/locations/{location}/reasoningEngines/{reasoning_engine}`
      Throws:
      ApiException - if the remote call fails
    • listMemories

      public final MemoryBankServiceClient.ListMemoriesPagedResponse listMemories(String parent)
      List Memories.

      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 (MemoryBankServiceClient memoryBankServiceClient = MemoryBankServiceClient.create()) {
         String parent =
             ReasoningEngineName.of("[PROJECT]", "[LOCATION]", "[REASONING_ENGINE]").toString();
         for (Memory element : memoryBankServiceClient.listMemories(parent).iterateAll()) {
           // doThingsWith(element);
         }
       }
       
      Parameters:
      parent - Required. The resource name of the ReasoningEngine to list the Memories under. Format: `projects/{project}/locations/{location}/reasoningEngines/{reasoning_engine}`
      Throws:
      ApiException - if the remote call fails
    • listMemories

      List Memories.

      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 (MemoryBankServiceClient memoryBankServiceClient = MemoryBankServiceClient.create()) {
         ListMemoriesRequest request =
             ListMemoriesRequest.newBuilder()
                 .setParent(
                     ReasoningEngineName.of("[PROJECT]", "[LOCATION]", "[REASONING_ENGINE]")
                         .toString())
                 .setFilter("filter-1274492040")
                 .setPageSize(883849137)
                 .setPageToken("pageToken873572522")
                 .build();
         for (Memory element : memoryBankServiceClient.listMemories(request).iterateAll()) {
           // doThingsWith(element);
         }
       }
       
      Parameters:
      request - The request object containing all of the parameters for the API call.
      Throws:
      ApiException - if the remote call fails
    • listMemoriesPagedCallable

      List Memories.

      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 (MemoryBankServiceClient memoryBankServiceClient = MemoryBankServiceClient.create()) {
         ListMemoriesRequest request =
             ListMemoriesRequest.newBuilder()
                 .setParent(
                     ReasoningEngineName.of("[PROJECT]", "[LOCATION]", "[REASONING_ENGINE]")
                         .toString())
                 .setFilter("filter-1274492040")
                 .setPageSize(883849137)
                 .setPageToken("pageToken873572522")
                 .build();
         ApiFuture<Memory> future =
             memoryBankServiceClient.listMemoriesPagedCallable().futureCall(request);
         // Do something.
         for (Memory element : future.get().iterateAll()) {
           // doThingsWith(element);
         }
       }
       
    • listMemoriesCallable

      public final UnaryCallable<ListMemoriesRequest,ListMemoriesResponse> listMemoriesCallable()
      List Memories.

      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 (MemoryBankServiceClient memoryBankServiceClient = MemoryBankServiceClient.create()) {
         ListMemoriesRequest request =
             ListMemoriesRequest.newBuilder()
                 .setParent(
                     ReasoningEngineName.of("[PROJECT]", "[LOCATION]", "[REASONING_ENGINE]")
                         .toString())
                 .setFilter("filter-1274492040")
                 .setPageSize(883849137)
                 .setPageToken("pageToken873572522")
                 .build();
         while (true) {
           ListMemoriesResponse response =
               memoryBankServiceClient.listMemoriesCallable().call(request);
           for (Memory element : response.getMemoriesList()) {
             // doThingsWith(element);
           }
           String nextPageToken = response.getNextPageToken();
           if (!Strings.isNullOrEmpty(nextPageToken)) {
             request = request.toBuilder().setPageToken(nextPageToken).build();
           } else {
             break;
           }
         }
       }
       
    • deleteMemoryAsync

      public final OperationFuture<com.google.protobuf.Empty,DeleteMemoryOperationMetadata> deleteMemoryAsync(MemoryName name)
      Delete a Memory.

      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 (MemoryBankServiceClient memoryBankServiceClient = MemoryBankServiceClient.create()) {
         MemoryName name = MemoryName.of("[PROJECT]", "[LOCATION]", "[REASONING_ENGINE]", "[MEMORY]");
         memoryBankServiceClient.deleteMemoryAsync(name).get();
       }
       
      Parameters:
      name - Required. The resource name of the Memory to delete. Format: `projects/{project}/locations/{location}/reasoningEngines/{reasoning_engine}/memories/{memory}`
      Throws:
      ApiException - if the remote call fails
    • deleteMemoryAsync

      public final OperationFuture<com.google.protobuf.Empty,DeleteMemoryOperationMetadata> deleteMemoryAsync(String name)
      Delete a Memory.

      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 (MemoryBankServiceClient memoryBankServiceClient = MemoryBankServiceClient.create()) {
         String name =
             MemoryName.of("[PROJECT]", "[LOCATION]", "[REASONING_ENGINE]", "[MEMORY]").toString();
         memoryBankServiceClient.deleteMemoryAsync(name).get();
       }
       
      Parameters:
      name - Required. The resource name of the Memory to delete. Format: `projects/{project}/locations/{location}/reasoningEngines/{reasoning_engine}/memories/{memory}`
      Throws:
      ApiException - if the remote call fails
    • deleteMemoryAsync

      public final OperationFuture<com.google.protobuf.Empty,DeleteMemoryOperationMetadata> deleteMemoryAsync(DeleteMemoryRequest request)
      Delete a Memory.

      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 (MemoryBankServiceClient memoryBankServiceClient = MemoryBankServiceClient.create()) {
         DeleteMemoryRequest request =
             DeleteMemoryRequest.newBuilder()
                 .setName(
                     MemoryName.of("[PROJECT]", "[LOCATION]", "[REASONING_ENGINE]", "[MEMORY]")
                         .toString())
                 .build();
         memoryBankServiceClient.deleteMemoryAsync(request).get();
       }
       
      Parameters:
      request - The request object containing all of the parameters for the API call.
      Throws:
      ApiException - if the remote call fails
    • deleteMemoryOperationCallable

      public final OperationCallable<DeleteMemoryRequest,com.google.protobuf.Empty,DeleteMemoryOperationMetadata> deleteMemoryOperationCallable()
      Delete a Memory.

      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 (MemoryBankServiceClient memoryBankServiceClient = MemoryBankServiceClient.create()) {
         DeleteMemoryRequest request =
             DeleteMemoryRequest.newBuilder()
                 .setName(
                     MemoryName.of("[PROJECT]", "[LOCATION]", "[REASONING_ENGINE]", "[MEMORY]")
                         .toString())
                 .build();
         OperationFuture<Empty, DeleteMemoryOperationMetadata> future =
             memoryBankServiceClient.deleteMemoryOperationCallable().futureCall(request);
         // Do something.
         future.get();
       }
       
    • deleteMemoryCallable

      public final UnaryCallable<DeleteMemoryRequest,Operation> deleteMemoryCallable()
      Delete a Memory.

      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 (MemoryBankServiceClient memoryBankServiceClient = MemoryBankServiceClient.create()) {
         DeleteMemoryRequest request =
             DeleteMemoryRequest.newBuilder()
                 .setName(
                     MemoryName.of("[PROJECT]", "[LOCATION]", "[REASONING_ENGINE]", "[MEMORY]")
                         .toString())
                 .build();
         ApiFuture<Operation> future =
             memoryBankServiceClient.deleteMemoryCallable().futureCall(request);
         // Do something.
         future.get();
       }
       
    • generateMemoriesAsync

      Generate memories.

      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 (MemoryBankServiceClient memoryBankServiceClient = MemoryBankServiceClient.create()) {
         ReasoningEngineName parent =
             ReasoningEngineName.of("[PROJECT]", "[LOCATION]", "[REASONING_ENGINE]");
         GenerateMemoriesResponse response =
             memoryBankServiceClient.generateMemoriesAsync(parent).get();
       }
       
      Parameters:
      parent - Required. The resource name of the ReasoningEngine to generate memories for. Format: `projects/{project}/locations/{location}/reasoningEngines/{reasoning_engine}`
      Throws:
      ApiException - if the remote call fails
    • generateMemoriesAsync

      Generate memories.

      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 (MemoryBankServiceClient memoryBankServiceClient = MemoryBankServiceClient.create()) {
         String parent =
             ReasoningEngineName.of("[PROJECT]", "[LOCATION]", "[REASONING_ENGINE]").toString();
         GenerateMemoriesResponse response =
             memoryBankServiceClient.generateMemoriesAsync(parent).get();
       }
       
      Parameters:
      parent - Required. The resource name of the ReasoningEngine to generate memories for. Format: `projects/{project}/locations/{location}/reasoningEngines/{reasoning_engine}`
      Throws:
      ApiException - if the remote call fails
    • generateMemoriesAsync

      Generate memories.

      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 (MemoryBankServiceClient memoryBankServiceClient = MemoryBankServiceClient.create()) {
         GenerateMemoriesRequest request =
             GenerateMemoriesRequest.newBuilder()
                 .setParent(
                     ReasoningEngineName.of("[PROJECT]", "[LOCATION]", "[REASONING_ENGINE]")
                         .toString())
                 .setDisableConsolidation(true)
                 .putAllScope(new HashMap<String, String>())
                 .build();
         GenerateMemoriesResponse response =
             memoryBankServiceClient.generateMemoriesAsync(request).get();
       }
       
      Parameters:
      request - The request object containing all of the parameters for the API call.
      Throws:
      ApiException - if the remote call fails
    • generateMemoriesOperationCallable

      Generate memories.

      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 (MemoryBankServiceClient memoryBankServiceClient = MemoryBankServiceClient.create()) {
         GenerateMemoriesRequest request =
             GenerateMemoriesRequest.newBuilder()
                 .setParent(
                     ReasoningEngineName.of("[PROJECT]", "[LOCATION]", "[REASONING_ENGINE]")
                         .toString())
                 .setDisableConsolidation(true)
                 .putAllScope(new HashMap<String, String>())
                 .build();
         OperationFuture<GenerateMemoriesResponse, GenerateMemoriesOperationMetadata> future =
             memoryBankServiceClient.generateMemoriesOperationCallable().futureCall(request);
         // Do something.
         GenerateMemoriesResponse response = future.get();
       }
       
    • generateMemoriesCallable

      public final UnaryCallable<GenerateMemoriesRequest,Operation> generateMemoriesCallable()
      Generate memories.

      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 (MemoryBankServiceClient memoryBankServiceClient = MemoryBankServiceClient.create()) {
         GenerateMemoriesRequest request =
             GenerateMemoriesRequest.newBuilder()
                 .setParent(
                     ReasoningEngineName.of("[PROJECT]", "[LOCATION]", "[REASONING_ENGINE]")
                         .toString())
                 .setDisableConsolidation(true)
                 .putAllScope(new HashMap<String, String>())
                 .build();
         ApiFuture<Operation> future =
             memoryBankServiceClient.generateMemoriesCallable().futureCall(request);
         // Do something.
         Operation response = future.get();
       }
       
    • retrieveMemories

      public final RetrieveMemoriesResponse retrieveMemories(ReasoningEngineName parent)
      Retrieve memories.

      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 (MemoryBankServiceClient memoryBankServiceClient = MemoryBankServiceClient.create()) {
         ReasoningEngineName parent =
             ReasoningEngineName.of("[PROJECT]", "[LOCATION]", "[REASONING_ENGINE]");
         RetrieveMemoriesResponse response = memoryBankServiceClient.retrieveMemories(parent);
       }
       
      Parameters:
      parent - Required. The resource name of the ReasoningEngine to retrieve memories from. Format: `projects/{project}/locations/{location}/reasoningEngines/{reasoning_engine}`
      Throws:
      ApiException - if the remote call fails
    • retrieveMemories

      public final RetrieveMemoriesResponse retrieveMemories(String parent)
      Retrieve memories.

      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 (MemoryBankServiceClient memoryBankServiceClient = MemoryBankServiceClient.create()) {
         String parent =
             ReasoningEngineName.of("[PROJECT]", "[LOCATION]", "[REASONING_ENGINE]").toString();
         RetrieveMemoriesResponse response = memoryBankServiceClient.retrieveMemories(parent);
       }
       
      Parameters:
      parent - Required. The resource name of the ReasoningEngine to retrieve memories from. Format: `projects/{project}/locations/{location}/reasoningEngines/{reasoning_engine}`
      Throws:
      ApiException - if the remote call fails
    • retrieveMemories

      public final RetrieveMemoriesResponse retrieveMemories(RetrieveMemoriesRequest request)
      Retrieve memories.

      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 (MemoryBankServiceClient memoryBankServiceClient = MemoryBankServiceClient.create()) {
         RetrieveMemoriesRequest request =
             RetrieveMemoriesRequest.newBuilder()
                 .setParent(
                     ReasoningEngineName.of("[PROJECT]", "[LOCATION]", "[REASONING_ENGINE]")
                         .toString())
                 .putAllScope(new HashMap<String, String>())
                 .build();
         RetrieveMemoriesResponse response = memoryBankServiceClient.retrieveMemories(request);
       }
       
      Parameters:
      request - The request object containing all of the parameters for the API call.
      Throws:
      ApiException - if the remote call fails
    • retrieveMemoriesCallable

      public final UnaryCallable<RetrieveMemoriesRequest,RetrieveMemoriesResponse> retrieveMemoriesCallable()
      Retrieve memories.

      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 (MemoryBankServiceClient memoryBankServiceClient = MemoryBankServiceClient.create()) {
         RetrieveMemoriesRequest request =
             RetrieveMemoriesRequest.newBuilder()
                 .setParent(
                     ReasoningEngineName.of("[PROJECT]", "[LOCATION]", "[REASONING_ENGINE]")
                         .toString())
                 .putAllScope(new HashMap<String, String>())
                 .build();
         ApiFuture<RetrieveMemoriesResponse> future =
             memoryBankServiceClient.retrieveMemoriesCallable().futureCall(request);
         // Do something.
         RetrieveMemoriesResponse response = future.get();
       }
       
    • listLocations

      Lists information about the supported locations for this service.

      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 (MemoryBankServiceClient memoryBankServiceClient = MemoryBankServiceClient.create()) {
         ListLocationsRequest request =
             ListLocationsRequest.newBuilder()
                 .setName("name3373707")
                 .setFilter("filter-1274492040")
                 .setPageSize(883849137)
                 .setPageToken("pageToken873572522")
                 .build();
         for (Location element : memoryBankServiceClient.listLocations(request).iterateAll()) {
           // doThingsWith(element);
         }
       }
       
      Parameters:
      request - The request object containing all of the parameters for the API call.
      Throws:
      ApiException - if the remote call fails
    • listLocationsPagedCallable

      Lists information about the supported locations for this service.

      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 (MemoryBankServiceClient memoryBankServiceClient = MemoryBankServiceClient.create()) {
         ListLocationsRequest request =
             ListLocationsRequest.newBuilder()
                 .setName("name3373707")
                 .setFilter("filter-1274492040")
                 .setPageSize(883849137)
                 .setPageToken("pageToken873572522")
                 .build();
         ApiFuture<Location> future =
             memoryBankServiceClient.listLocationsPagedCallable().futureCall(request);
         // Do something.
         for (Location element : future.get().iterateAll()) {
           // doThingsWith(element);
         }
       }
       
    • listLocationsCallable

      public final UnaryCallable<ListLocationsRequest,ListLocationsResponse> listLocationsCallable()
      Lists information about the supported locations for this service.

      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 (MemoryBankServiceClient memoryBankServiceClient = MemoryBankServiceClient.create()) {
         ListLocationsRequest request =
             ListLocationsRequest.newBuilder()
                 .setName("name3373707")
                 .setFilter("filter-1274492040")
                 .setPageSize(883849137)
                 .setPageToken("pageToken873572522")
                 .build();
         while (true) {
           ListLocationsResponse response =
               memoryBankServiceClient.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;
           }
         }
       }
       
    • getLocation

      public final Location getLocation(GetLocationRequest request)
      Gets information about a location.

      Sample code:

      
       // This snippet has been automatically generated and should be regarded as a code template only.
       // It will require modifications to work:
       // - It may require correct/in-range values for request initialization.
       // - It may require specifying regional endpoints when creating the service client as shown in
       // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
       try (MemoryBankServiceClient memoryBankServiceClient = MemoryBankServiceClient.create()) {
         GetLocationRequest request = GetLocationRequest.newBuilder().setName("name3373707").build();
         Location response = memoryBankServiceClient.getLocation(request);
       }
       
      Parameters:
      request - The request object containing all of the parameters for the API call.
      Throws:
      ApiException - if the remote call fails
    • getLocationCallable

      public final UnaryCallable<GetLocationRequest,Location> getLocationCallable()
      Gets information about a location.

      Sample code:

      
       // This snippet has been automatically generated and should be regarded as a code template only.
       // It will require modifications to work:
       // - It may require correct/in-range values for request initialization.
       // - It may require specifying regional endpoints when creating the service client as shown in
       // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
       try (MemoryBankServiceClient memoryBankServiceClient = MemoryBankServiceClient.create()) {
         GetLocationRequest request = GetLocationRequest.newBuilder().setName("name3373707").build();
         ApiFuture<Location> future =
             memoryBankServiceClient.getLocationCallable().futureCall(request);
         // Do something.
         Location response = future.get();
       }
       
    • setIamPolicy

      public final Policy setIamPolicy(SetIamPolicyRequest request)
      Sets the access control policy on the specified resource. Replacesany existing policy.

      Can return `NOT_FOUND`, `INVALID_ARGUMENT`, and `PERMISSION_DENIED`errors.

      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 (MemoryBankServiceClient memoryBankServiceClient = MemoryBankServiceClient.create()) {
         SetIamPolicyRequest request =
             SetIamPolicyRequest.newBuilder()
                 .setResource(
                     EndpointName.ofProjectLocationEndpointName(
                             "[PROJECT]", "[LOCATION]", "[ENDPOINT]")
                         .toString())
                 .setPolicy(Policy.newBuilder().build())
                 .setUpdateMask(FieldMask.newBuilder().build())
                 .build();
         Policy response = memoryBankServiceClient.setIamPolicy(request);
       }
       
      Parameters:
      request - The request object containing all of the parameters for the API call.
      Throws:
      ApiException - if the remote call fails
    • setIamPolicyCallable

      public final UnaryCallable<SetIamPolicyRequest,Policy> setIamPolicyCallable()
      Sets the access control policy on the specified resource. Replacesany existing policy.

      Can return `NOT_FOUND`, `INVALID_ARGUMENT`, and `PERMISSION_DENIED`errors.

      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 (MemoryBankServiceClient memoryBankServiceClient = MemoryBankServiceClient.create()) {
         SetIamPolicyRequest request =
             SetIamPolicyRequest.newBuilder()
                 .setResource(
                     EndpointName.ofProjectLocationEndpointName(
                             "[PROJECT]", "[LOCATION]", "[ENDPOINT]")
                         .toString())
                 .setPolicy(Policy.newBuilder().build())
                 .setUpdateMask(FieldMask.newBuilder().build())
                 .build();
         ApiFuture<Policy> future = memoryBankServiceClient.setIamPolicyCallable().futureCall(request);
         // Do something.
         Policy response = future.get();
       }
       
    • getIamPolicy

      public final Policy getIamPolicy(GetIamPolicyRequest request)
      Gets the access control policy for a resource. Returns an empty policyif the resource exists and does not have a policy set.

      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 (MemoryBankServiceClient memoryBankServiceClient = MemoryBankServiceClient.create()) {
         GetIamPolicyRequest request =
             GetIamPolicyRequest.newBuilder()
                 .setResource(
                     EndpointName.ofProjectLocationEndpointName(
                             "[PROJECT]", "[LOCATION]", "[ENDPOINT]")
                         .toString())
                 .setOptions(GetPolicyOptions.newBuilder().build())
                 .build();
         Policy response = memoryBankServiceClient.getIamPolicy(request);
       }
       
      Parameters:
      request - The request object containing all of the parameters for the API call.
      Throws:
      ApiException - if the remote call fails
    • getIamPolicyCallable

      public final UnaryCallable<GetIamPolicyRequest,Policy> getIamPolicyCallable()
      Gets the access control policy for a resource. Returns an empty policyif the resource exists and does not have a policy set.

      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 (MemoryBankServiceClient memoryBankServiceClient = MemoryBankServiceClient.create()) {
         GetIamPolicyRequest request =
             GetIamPolicyRequest.newBuilder()
                 .setResource(
                     EndpointName.ofProjectLocationEndpointName(
                             "[PROJECT]", "[LOCATION]", "[ENDPOINT]")
                         .toString())
                 .setOptions(GetPolicyOptions.newBuilder().build())
                 .build();
         ApiFuture<Policy> future = memoryBankServiceClient.getIamPolicyCallable().futureCall(request);
         // Do something.
         Policy response = future.get();
       }
       
    • testIamPermissions

      public final TestIamPermissionsResponse testIamPermissions(TestIamPermissionsRequest request)
      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:

      
       // 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 (MemoryBankServiceClient memoryBankServiceClient = MemoryBankServiceClient.create()) {
         TestIamPermissionsRequest request =
             TestIamPermissionsRequest.newBuilder()
                 .setResource(
                     EndpointName.ofProjectLocationEndpointName(
                             "[PROJECT]", "[LOCATION]", "[ENDPOINT]")
                         .toString())
                 .addAllPermissions(new ArrayList<String>())
                 .build();
         TestIamPermissionsResponse response = memoryBankServiceClient.testIamPermissions(request);
       }
       
      Parameters:
      request - The request object containing all of the parameters for the API call.
      Throws:
      ApiException - if the remote call fails
    • testIamPermissionsCallable

      public final UnaryCallable<TestIamPermissionsRequest,TestIamPermissionsResponse> testIamPermissionsCallable()
      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:

      
       // 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 (MemoryBankServiceClient memoryBankServiceClient = MemoryBankServiceClient.create()) {
         TestIamPermissionsRequest request =
             TestIamPermissionsRequest.newBuilder()
                 .setResource(
                     EndpointName.ofProjectLocationEndpointName(
                             "[PROJECT]", "[LOCATION]", "[ENDPOINT]")
                         .toString())
                 .addAllPermissions(new ArrayList<String>())
                 .build();
         ApiFuture<TestIamPermissionsResponse> future =
             memoryBankServiceClient.testIamPermissionsCallable().futureCall(request);
         // Do something.
         TestIamPermissionsResponse response = future.get();
       }
       
    • close

      public final void close()
      Specified by:
      close in interface AutoCloseable
    • shutdown

      public void shutdown()
      Specified by:
      shutdown in interface BackgroundResource
    • isShutdown

      public boolean isShutdown()
      Specified by:
      isShutdown in interface BackgroundResource
    • isTerminated

      public boolean isTerminated()
      Specified by:
      isTerminated in interface BackgroundResource
    • shutdownNow

      public void shutdownNow()
      Specified by:
      shutdownNow in interface BackgroundResource
    • awaitTermination

      public boolean awaitTermination(long duration, TimeUnit unit) throws InterruptedException
      Specified by:
      awaitTermination in interface BackgroundResource
      Throws:
      InterruptedException