Class MemoryBankServiceClient
- All Implemented Interfaces:
BackgroundResource,AutoCloseable
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().
| 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.
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.
|
GetMemory |
Get a Memory. |
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.
|
UpdateMemory |
Update a Memory. |
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.
|
ListMemories |
List Memories. |
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.
|
DeleteMemory |
Delete a Memory. |
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.
|
GenerateMemories |
Generate memories. |
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.
|
RetrieveMemories |
Retrieve memories. |
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 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.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classstatic classstatic classstatic classstatic classstatic class -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedConstructs an instance of MemoryBankServiceClient, using the given settings.protected -
Method Summary
Modifier and TypeMethodDescriptionbooleanawaitTermination(long duration, TimeUnit unit) final voidclose()static final MemoryBankServiceClientcreate()Constructs an instance of MemoryBankServiceClient with default settings.static final MemoryBankServiceClientcreate(MemoryBankServiceSettings settings) Constructs an instance of MemoryBankServiceClient, using the given settings.static final MemoryBankServiceClientcreate(MemoryBankServiceStub stub) Constructs an instance of MemoryBankServiceClient, using the given stub for making calls.createMemoryAsync(CreateMemoryRequest request) Create a Memory.createMemoryAsync(ReasoningEngineName parent, Memory memory, String memoryId) Create a Memory.createMemoryAsync(String parent, Memory memory, String memoryId) Create a Memory.Create a Memory.Create a Memory.final OperationFuture<com.google.protobuf.Empty,DeleteMemoryOperationMetadata> deleteMemoryAsync(DeleteMemoryRequest request) Delete a Memory.final OperationFuture<com.google.protobuf.Empty,DeleteMemoryOperationMetadata> deleteMemoryAsync(MemoryName name) Delete a Memory.final OperationFuture<com.google.protobuf.Empty,DeleteMemoryOperationMetadata> deleteMemoryAsync(String name) Delete a Memory.Delete a Memory.final OperationCallable<DeleteMemoryRequest,com.google.protobuf.Empty, DeleteMemoryOperationMetadata> Delete a Memory.Generate memories.Generate memories.generateMemoriesAsync(String parent) Generate memories.Generate memories.final OperationCallable<GenerateMemoriesRequest,GenerateMemoriesResponse, GenerateMemoriesOperationMetadata> Generate memories.final PolicygetIamPolicy(GetIamPolicyRequest request) Gets the access control policy for a resource.Gets the access control policy for a resource.final LocationgetLocation(GetLocationRequest request) Gets information about a location.Gets information about a location.final MemorygetMemory(GetMemoryRequest request) Get a Memory.final MemorygetMemory(MemoryName name) Get a Memory.final MemoryGet a Memory.final UnaryCallable<GetMemoryRequest,Memory> Get a Memory.final OperationsClientReturns the OperationsClient that can be used to query the status of a long-running operation returned by another API method call.getStub()booleanbooleanlistLocations(ListLocationsRequest request) Lists information about the supported locations for this service.Lists information about the supported locations for this service.Lists information about the supported locations for this service.listMemories(ListMemoriesRequest request) List Memories.listMemories(ReasoningEngineName parent) List Memories.listMemories(String parent) List Memories.List Memories.List Memories.final RetrieveMemoriesResponseretrieveMemories(ReasoningEngineName parent) Retrieve memories.final RetrieveMemoriesResponseretrieveMemories(RetrieveMemoriesRequest request) Retrieve memories.final RetrieveMemoriesResponseretrieveMemories(String parent) Retrieve memories.Retrieve memories.final PolicysetIamPolicy(SetIamPolicyRequest request) Sets the access control policy on the specified resource.Sets the access control policy on the specified resource.voidshutdown()voidReturns permissions that a caller has on the specified resource.Returns permissions that a caller has on the specified resource.updateMemoryAsync(Memory memory, com.google.protobuf.FieldMask updateMask) Update a Memory.updateMemoryAsync(UpdateMemoryRequest request) Update a Memory.Update a Memory.Update a Memory.
-
Constructor Details
-
MemoryBankServiceClient
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
-
-
Method Details
-
create
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
Constructs an instance of MemoryBankServiceClient, using the given stub for making calls. This is for advanced usage - prefer using create(MemoryBankServiceSettings). -
getSettings
-
getStub
-
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, createMemoryOperationCallable()CreateMemoryOperationMetadata> 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
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
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
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
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
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, updateMemoryOperationCallable()UpdateMemoryOperationMetadata> 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
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
public final MemoryBankServiceClient.ListMemoriesPagedResponse listMemories(ReasoningEngineName 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()) { 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
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
public final MemoryBankServiceClient.ListMemoriesPagedResponse listMemories(ListMemoriesRequest request) 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
public final UnaryCallable<ListMemoriesRequest,MemoryBankServiceClient.ListMemoriesPagedResponse> 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
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, deleteMemoryOperationCallable()DeleteMemoryOperationMetadata> 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
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
public final OperationFuture<GenerateMemoriesResponse,GenerateMemoriesOperationMetadata> generateMemoriesAsync(ReasoningEngineName parent) 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
public final OperationFuture<GenerateMemoriesResponse,GenerateMemoriesOperationMetadata> generateMemoriesAsync(String parent) 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
public final OperationFuture<GenerateMemoriesResponse,GenerateMemoriesOperationMetadata> generateMemoriesAsync(GenerateMemoriesRequest request) 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
public final OperationCallable<GenerateMemoriesRequest,GenerateMemoriesResponse, generateMemoriesOperationCallable()GenerateMemoriesOperationMetadata> 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
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
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
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
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
public final MemoryBankServiceClient.ListLocationsPagedResponse listLocations(ListLocationsRequest request) 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
public final UnaryCallable<ListLocationsRequest,MemoryBankServiceClient.ListLocationsPagedResponse> 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
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
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
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
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
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
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
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
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:
closein interfaceAutoCloseable
-
shutdown
public void shutdown()- Specified by:
shutdownin interfaceBackgroundResource
-
isShutdown
public boolean isShutdown()- Specified by:
isShutdownin interfaceBackgroundResource
-
isTerminated
public boolean isTerminated()- Specified by:
isTerminatedin interfaceBackgroundResource
-
shutdownNow
public void shutdownNow()- Specified by:
shutdownNowin interfaceBackgroundResource
-
awaitTermination
- Specified by:
awaitTerminationin interfaceBackgroundResource- Throws:
InterruptedException
-