@BetaApi @Generated(value="by gapic-generator-java") public class MemoryBankServiceClient extends Object implements com.google.api.gax.core.BackgroundResource
This class provides the ability to make remote calls to the backing service through method calls that map to API methods. Sample code to get started:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (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.
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.
| Modifier and Type | Class and Description |
|---|---|
static class |
MemoryBankServiceClient.ListLocationsFixedSizeCollection |
static class |
MemoryBankServiceClient.ListLocationsPage |
static class |
MemoryBankServiceClient.ListLocationsPagedResponse |
static class |
MemoryBankServiceClient.ListMemoriesFixedSizeCollection |
static class |
MemoryBankServiceClient.ListMemoriesPage |
static class |
MemoryBankServiceClient.ListMemoriesPagedResponse |
| Modifier | Constructor and Description |
|---|---|
protected |
MemoryBankServiceClient(MemoryBankServiceSettings settings)
Constructs an instance of MemoryBankServiceClient, using the given settings.
|
protected |
MemoryBankServiceClient(MemoryBankServiceStub stub) |
| Modifier and Type | Method and Description |
|---|---|
boolean |
awaitTermination(long duration,
TimeUnit unit) |
void |
close() |
static MemoryBankServiceClient |
create()
Constructs an instance of MemoryBankServiceClient with default settings.
|
static MemoryBankServiceClient |
create(MemoryBankServiceSettings settings)
Constructs an instance of MemoryBankServiceClient, using the given settings.
|
static MemoryBankServiceClient |
create(MemoryBankServiceStub stub)
Constructs an instance of MemoryBankServiceClient, using the given stub for making calls.
|
com.google.api.gax.longrunning.OperationFuture<Memory,CreateMemoryOperationMetadata> |
createMemoryAsync(CreateMemoryRequest request)
Create a Memory.
|
com.google.api.gax.rpc.UnaryCallable<CreateMemoryRequest,com.google.longrunning.Operation> |
createMemoryCallable()
Create a Memory.
|
com.google.api.gax.rpc.OperationCallable<CreateMemoryRequest,Memory,CreateMemoryOperationMetadata> |
createMemoryOperationCallable()
Create a Memory.
|
com.google.api.gax.longrunning.OperationFuture<com.google.protobuf.Empty,DeleteMemoryOperationMetadata> |
deleteMemoryAsync(DeleteMemoryRequest request)
Delete a Memory.
|
com.google.api.gax.longrunning.OperationFuture<com.google.protobuf.Empty,DeleteMemoryOperationMetadata> |
deleteMemoryAsync(MemoryName name)
Delete a Memory.
|
com.google.api.gax.longrunning.OperationFuture<com.google.protobuf.Empty,DeleteMemoryOperationMetadata> |
deleteMemoryAsync(String name)
Delete a Memory.
|
com.google.api.gax.rpc.UnaryCallable<DeleteMemoryRequest,com.google.longrunning.Operation> |
deleteMemoryCallable()
Delete a Memory.
|
com.google.api.gax.rpc.OperationCallable<DeleteMemoryRequest,com.google.protobuf.Empty,DeleteMemoryOperationMetadata> |
deleteMemoryOperationCallable()
Delete a Memory.
|
com.google.api.gax.longrunning.OperationFuture<GenerateMemoriesResponse,GenerateMemoriesOperationMetadata> |
generateMemoriesAsync(GenerateMemoriesRequest request)
Generate memories.
|
com.google.api.gax.longrunning.OperationFuture<GenerateMemoriesResponse,GenerateMemoriesOperationMetadata> |
generateMemoriesAsync(ReasoningEngineName parent)
Generate memories.
|
com.google.api.gax.longrunning.OperationFuture<GenerateMemoriesResponse,GenerateMemoriesOperationMetadata> |
generateMemoriesAsync(String parent)
Generate memories.
|
com.google.api.gax.rpc.UnaryCallable<GenerateMemoriesRequest,com.google.longrunning.Operation> |
generateMemoriesCallable()
Generate memories.
|
com.google.api.gax.rpc.OperationCallable<GenerateMemoriesRequest,GenerateMemoriesResponse,GenerateMemoriesOperationMetadata> |
generateMemoriesOperationCallable()
Generate memories.
|
com.google.iam.v1.Policy |
getIamPolicy(com.google.iam.v1.GetIamPolicyRequest request)
Gets the access control policy for a resource.
|
com.google.api.gax.rpc.UnaryCallable<com.google.iam.v1.GetIamPolicyRequest,com.google.iam.v1.Policy> |
getIamPolicyCallable()
Gets the access control policy for a resource.
|
com.google.cloud.location.Location |
getLocation(com.google.cloud.location.GetLocationRequest request)
Gets information about a location.
|
com.google.api.gax.rpc.UnaryCallable<com.google.cloud.location.GetLocationRequest,com.google.cloud.location.Location> |
getLocationCallable()
Gets information about a location.
|
Memory |
getMemory(GetMemoryRequest request)
Get a Memory.
|
Memory |
getMemory(MemoryName name)
Get a Memory.
|
Memory |
getMemory(String name)
Get a Memory.
|
com.google.api.gax.rpc.UnaryCallable<GetMemoryRequest,Memory> |
getMemoryCallable()
Get a Memory.
|
com.google.longrunning.OperationsClient |
getOperationsClient()
Returns the OperationsClient that can be used to query the status of a long-running operation
returned by another API method call.
|
MemoryBankServiceSettings |
getSettings() |
MemoryBankServiceStub |
getStub() |
boolean |
isShutdown() |
boolean |
isTerminated() |
MemoryBankServiceClient.ListLocationsPagedResponse |
listLocations(com.google.cloud.location.ListLocationsRequest request)
Lists information about the supported locations for this service.
|
com.google.api.gax.rpc.UnaryCallable<com.google.cloud.location.ListLocationsRequest,com.google.cloud.location.ListLocationsResponse> |
listLocationsCallable()
Lists information about the supported locations for this service.
|
com.google.api.gax.rpc.UnaryCallable<com.google.cloud.location.ListLocationsRequest,MemoryBankServiceClient.ListLocationsPagedResponse> |
listLocationsPagedCallable()
Lists information about the supported locations for this service.
|
MemoryBankServiceClient.ListMemoriesPagedResponse |
listMemories(ListMemoriesRequest request)
List Memories.
|
MemoryBankServiceClient.ListMemoriesPagedResponse |
listMemories(ReasoningEngineName parent)
List Memories.
|
MemoryBankServiceClient.ListMemoriesPagedResponse |
listMemories(String parent)
List Memories.
|
com.google.api.gax.rpc.UnaryCallable<ListMemoriesRequest,ListMemoriesResponse> |
listMemoriesCallable()
List Memories.
|
com.google.api.gax.rpc.UnaryCallable<ListMemoriesRequest,MemoryBankServiceClient.ListMemoriesPagedResponse> |
listMemoriesPagedCallable()
List Memories.
|
RetrieveMemoriesResponse |
retrieveMemories(ReasoningEngineName parent)
Retrieve memories.
|
RetrieveMemoriesResponse |
retrieveMemories(RetrieveMemoriesRequest request)
Retrieve memories.
|
RetrieveMemoriesResponse |
retrieveMemories(String parent)
Retrieve memories.
|
com.google.api.gax.rpc.UnaryCallable<RetrieveMemoriesRequest,RetrieveMemoriesResponse> |
retrieveMemoriesCallable()
Retrieve memories.
|
com.google.iam.v1.Policy |
setIamPolicy(com.google.iam.v1.SetIamPolicyRequest request)
Sets the access control policy on the specified resource.
|
com.google.api.gax.rpc.UnaryCallable<com.google.iam.v1.SetIamPolicyRequest,com.google.iam.v1.Policy> |
setIamPolicyCallable()
Sets the access control policy on the specified resource.
|
void |
shutdown() |
void |
shutdownNow() |
com.google.iam.v1.TestIamPermissionsResponse |
testIamPermissions(com.google.iam.v1.TestIamPermissionsRequest request)
Returns permissions that a caller has on the specified resource.
|
com.google.api.gax.rpc.UnaryCallable<com.google.iam.v1.TestIamPermissionsRequest,com.google.iam.v1.TestIamPermissionsResponse> |
testIamPermissionsCallable()
Returns permissions that a caller has on the specified resource.
|
com.google.api.gax.longrunning.OperationFuture<Memory,UpdateMemoryOperationMetadata> |
updateMemoryAsync(Memory memory,
com.google.protobuf.FieldMask updateMask)
Update a Memory.
|
com.google.api.gax.longrunning.OperationFuture<Memory,UpdateMemoryOperationMetadata> |
updateMemoryAsync(UpdateMemoryRequest request)
Update a Memory.
|
com.google.api.gax.rpc.UnaryCallable<UpdateMemoryRequest,com.google.longrunning.Operation> |
updateMemoryCallable()
Update a Memory.
|
com.google.api.gax.rpc.OperationCallable<UpdateMemoryRequest,Memory,UpdateMemoryOperationMetadata> |
updateMemoryOperationCallable()
Update a Memory.
|
protected MemoryBankServiceClient(MemoryBankServiceSettings settings) throws IOException
IOExceptionprotected MemoryBankServiceClient(MemoryBankServiceStub stub)
public static final MemoryBankServiceClient create() throws IOException
IOExceptionpublic static final MemoryBankServiceClient create(MemoryBankServiceSettings settings) throws IOException
IOExceptionpublic static final MemoryBankServiceClient create(MemoryBankServiceStub stub)
public final MemoryBankServiceSettings getSettings()
public MemoryBankServiceStub getStub()
public final com.google.longrunning.OperationsClient getOperationsClient()
public final com.google.api.gax.longrunning.OperationFuture<Memory,CreateMemoryOperationMetadata> createMemoryAsync(CreateMemoryRequest request)
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (MemoryBankServiceClient memoryBankServiceClient = MemoryBankServiceClient.create()) {
CreateMemoryRequest request =
CreateMemoryRequest.newBuilder()
.setParent(
ReasoningEngineName.of("[PROJECT]", "[LOCATION]", "[REASONING_ENGINE]")
.toString())
.setMemory(Memory.newBuilder().build())
.build();
Memory response = memoryBankServiceClient.createMemoryAsync(request).get();
}
request - The request object containing all of the parameters for the API call.com.google.api.gax.rpc.ApiException - if the remote call failspublic final com.google.api.gax.rpc.OperationCallable<CreateMemoryRequest,Memory,CreateMemoryOperationMetadata> createMemoryOperationCallable()
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())
.build();
OperationFuture<Memory, CreateMemoryOperationMetadata> future =
memoryBankServiceClient.createMemoryOperationCallable().futureCall(request);
// Do something.
Memory response = future.get();
}
public final com.google.api.gax.rpc.UnaryCallable<CreateMemoryRequest,com.google.longrunning.Operation> createMemoryCallable()
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())
.build();
ApiFuture<Operation> future =
memoryBankServiceClient.createMemoryCallable().futureCall(request);
// Do something.
Operation response = future.get();
}
public final Memory getMemory(MemoryName name)
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (MemoryBankServiceClient memoryBankServiceClient = MemoryBankServiceClient.create()) {
MemoryName name = MemoryName.of("[PROJECT]", "[LOCATION]", "[REASONING_ENGINE]", "[MEMORY]");
Memory response = memoryBankServiceClient.getMemory(name);
}
name - Required. The resource name of the Memory. Format:
`projects/{project}/locations/{location}/reasoningEngines/{reasoning_engine}/memories/{memory}`com.google.api.gax.rpc.ApiException - if the remote call failspublic final Memory getMemory(String name)
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (MemoryBankServiceClient memoryBankServiceClient = MemoryBankServiceClient.create()) {
String name =
MemoryName.of("[PROJECT]", "[LOCATION]", "[REASONING_ENGINE]", "[MEMORY]").toString();
Memory response = memoryBankServiceClient.getMemory(name);
}
name - Required. The resource name of the Memory. Format:
`projects/{project}/locations/{location}/reasoningEngines/{reasoning_engine}/memories/{memory}`com.google.api.gax.rpc.ApiException - if the remote call failspublic final Memory getMemory(GetMemoryRequest request)
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (MemoryBankServiceClient memoryBankServiceClient = MemoryBankServiceClient.create()) {
GetMemoryRequest request =
GetMemoryRequest.newBuilder()
.setName(
MemoryName.of("[PROJECT]", "[LOCATION]", "[REASONING_ENGINE]", "[MEMORY]")
.toString())
.build();
Memory response = memoryBankServiceClient.getMemory(request);
}
request - The request object containing all of the parameters for the API call.com.google.api.gax.rpc.ApiException - if the remote call failspublic final com.google.api.gax.rpc.UnaryCallable<GetMemoryRequest,Memory> getMemoryCallable()
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();
}
public final com.google.api.gax.longrunning.OperationFuture<Memory,UpdateMemoryOperationMetadata> updateMemoryAsync(Memory memory, com.google.protobuf.FieldMask updateMask)
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (MemoryBankServiceClient memoryBankServiceClient = MemoryBankServiceClient.create()) {
Memory memory = Memory.newBuilder().build();
FieldMask updateMask = FieldMask.newBuilder().build();
Memory response = memoryBankServiceClient.updateMemoryAsync(memory, updateMask).get();
}
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`
com.google.api.gax.rpc.ApiException - if the remote call failspublic final com.google.api.gax.longrunning.OperationFuture<Memory,UpdateMemoryOperationMetadata> updateMemoryAsync(UpdateMemoryRequest request)
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (MemoryBankServiceClient memoryBankServiceClient = MemoryBankServiceClient.create()) {
UpdateMemoryRequest request =
UpdateMemoryRequest.newBuilder()
.setMemory(Memory.newBuilder().build())
.setUpdateMask(FieldMask.newBuilder().build())
.build();
Memory response = memoryBankServiceClient.updateMemoryAsync(request).get();
}
request - The request object containing all of the parameters for the API call.com.google.api.gax.rpc.ApiException - if the remote call failspublic final com.google.api.gax.rpc.OperationCallable<UpdateMemoryRequest,Memory,UpdateMemoryOperationMetadata> updateMemoryOperationCallable()
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();
}
public final com.google.api.gax.rpc.UnaryCallable<UpdateMemoryRequest,com.google.longrunning.Operation> updateMemoryCallable()
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();
}
public final MemoryBankServiceClient.ListMemoriesPagedResponse listMemories(ReasoningEngineName parent)
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (MemoryBankServiceClient memoryBankServiceClient = MemoryBankServiceClient.create()) {
ReasoningEngineName parent =
ReasoningEngineName.of("[PROJECT]", "[LOCATION]", "[REASONING_ENGINE]");
for (Memory element : memoryBankServiceClient.listMemories(parent).iterateAll()) {
// doThingsWith(element);
}
}
parent - Required. The resource name of the ReasoningEngine to list the Memories under.
Format: `projects/{project}/locations/{location}/reasoningEngines/{reasoning_engine}`com.google.api.gax.rpc.ApiException - if the remote call failspublic final MemoryBankServiceClient.ListMemoriesPagedResponse listMemories(String parent)
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (MemoryBankServiceClient memoryBankServiceClient = MemoryBankServiceClient.create()) {
String parent =
ReasoningEngineName.of("[PROJECT]", "[LOCATION]", "[REASONING_ENGINE]").toString();
for (Memory element : memoryBankServiceClient.listMemories(parent).iterateAll()) {
// doThingsWith(element);
}
}
parent - Required. The resource name of the ReasoningEngine to list the Memories under.
Format: `projects/{project}/locations/{location}/reasoningEngines/{reasoning_engine}`com.google.api.gax.rpc.ApiException - if the remote call failspublic final MemoryBankServiceClient.ListMemoriesPagedResponse listMemories(ListMemoriesRequest request)
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (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);
}
}
request - The request object containing all of the parameters for the API call.com.google.api.gax.rpc.ApiException - if the remote call failspublic final com.google.api.gax.rpc.UnaryCallable<ListMemoriesRequest,MemoryBankServiceClient.ListMemoriesPagedResponse> listMemoriesPagedCallable()
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);
}
}
public final com.google.api.gax.rpc.UnaryCallable<ListMemoriesRequest,ListMemoriesResponse> listMemoriesCallable()
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;
}
}
}
public final com.google.api.gax.longrunning.OperationFuture<com.google.protobuf.Empty,DeleteMemoryOperationMetadata> deleteMemoryAsync(MemoryName name)
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (MemoryBankServiceClient memoryBankServiceClient = MemoryBankServiceClient.create()) {
MemoryName name = MemoryName.of("[PROJECT]", "[LOCATION]", "[REASONING_ENGINE]", "[MEMORY]");
memoryBankServiceClient.deleteMemoryAsync(name).get();
}
name - Required. The resource name of the Memory to delete. Format:
`projects/{project}/locations/{location}/reasoningEngines/{reasoning_engine}/memories/{memory}`com.google.api.gax.rpc.ApiException - if the remote call failspublic final com.google.api.gax.longrunning.OperationFuture<com.google.protobuf.Empty,DeleteMemoryOperationMetadata> deleteMemoryAsync(String name)
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (MemoryBankServiceClient memoryBankServiceClient = MemoryBankServiceClient.create()) {
String name =
MemoryName.of("[PROJECT]", "[LOCATION]", "[REASONING_ENGINE]", "[MEMORY]").toString();
memoryBankServiceClient.deleteMemoryAsync(name).get();
}
name - Required. The resource name of the Memory to delete. Format:
`projects/{project}/locations/{location}/reasoningEngines/{reasoning_engine}/memories/{memory}`com.google.api.gax.rpc.ApiException - if the remote call failspublic final com.google.api.gax.longrunning.OperationFuture<com.google.protobuf.Empty,DeleteMemoryOperationMetadata> deleteMemoryAsync(DeleteMemoryRequest request)
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (MemoryBankServiceClient memoryBankServiceClient = MemoryBankServiceClient.create()) {
DeleteMemoryRequest request =
DeleteMemoryRequest.newBuilder()
.setName(
MemoryName.of("[PROJECT]", "[LOCATION]", "[REASONING_ENGINE]", "[MEMORY]")
.toString())
.build();
memoryBankServiceClient.deleteMemoryAsync(request).get();
}
request - The request object containing all of the parameters for the API call.com.google.api.gax.rpc.ApiException - if the remote call failspublic final com.google.api.gax.rpc.OperationCallable<DeleteMemoryRequest,com.google.protobuf.Empty,DeleteMemoryOperationMetadata> deleteMemoryOperationCallable()
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();
}
public final com.google.api.gax.rpc.UnaryCallable<DeleteMemoryRequest,com.google.longrunning.Operation> deleteMemoryCallable()
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();
}
public final com.google.api.gax.longrunning.OperationFuture<GenerateMemoriesResponse,GenerateMemoriesOperationMetadata> generateMemoriesAsync(ReasoningEngineName parent)
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (MemoryBankServiceClient memoryBankServiceClient = MemoryBankServiceClient.create()) {
ReasoningEngineName parent =
ReasoningEngineName.of("[PROJECT]", "[LOCATION]", "[REASONING_ENGINE]");
GenerateMemoriesResponse response =
memoryBankServiceClient.generateMemoriesAsync(parent).get();
}
parent - Required. The resource name of the ReasoningEngine to generate memories for.
Format: `projects/{project}/locations/{location}/reasoningEngines/{reasoning_engine}`com.google.api.gax.rpc.ApiException - if the remote call failspublic final com.google.api.gax.longrunning.OperationFuture<GenerateMemoriesResponse,GenerateMemoriesOperationMetadata> generateMemoriesAsync(String parent)
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (MemoryBankServiceClient memoryBankServiceClient = MemoryBankServiceClient.create()) {
String parent =
ReasoningEngineName.of("[PROJECT]", "[LOCATION]", "[REASONING_ENGINE]").toString();
GenerateMemoriesResponse response =
memoryBankServiceClient.generateMemoriesAsync(parent).get();
}
parent - Required. The resource name of the ReasoningEngine to generate memories for.
Format: `projects/{project}/locations/{location}/reasoningEngines/{reasoning_engine}`com.google.api.gax.rpc.ApiException - if the remote call failspublic final com.google.api.gax.longrunning.OperationFuture<GenerateMemoriesResponse,GenerateMemoriesOperationMetadata> generateMemoriesAsync(GenerateMemoriesRequest request)
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (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();
}
request - The request object containing all of the parameters for the API call.com.google.api.gax.rpc.ApiException - if the remote call failspublic final com.google.api.gax.rpc.OperationCallable<GenerateMemoriesRequest,GenerateMemoriesResponse,GenerateMemoriesOperationMetadata> generateMemoriesOperationCallable()
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();
}
public final com.google.api.gax.rpc.UnaryCallable<GenerateMemoriesRequest,com.google.longrunning.Operation> generateMemoriesCallable()
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();
}
public final RetrieveMemoriesResponse retrieveMemories(ReasoningEngineName parent)
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (MemoryBankServiceClient memoryBankServiceClient = MemoryBankServiceClient.create()) {
ReasoningEngineName parent =
ReasoningEngineName.of("[PROJECT]", "[LOCATION]", "[REASONING_ENGINE]");
RetrieveMemoriesResponse response = memoryBankServiceClient.retrieveMemories(parent);
}
parent - Required. The resource name of the ReasoningEngine to retrieve memories from.
Format: `projects/{project}/locations/{location}/reasoningEngines/{reasoning_engine}`com.google.api.gax.rpc.ApiException - if the remote call failspublic final RetrieveMemoriesResponse retrieveMemories(String parent)
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (MemoryBankServiceClient memoryBankServiceClient = MemoryBankServiceClient.create()) {
String parent =
ReasoningEngineName.of("[PROJECT]", "[LOCATION]", "[REASONING_ENGINE]").toString();
RetrieveMemoriesResponse response = memoryBankServiceClient.retrieveMemories(parent);
}
parent - Required. The resource name of the ReasoningEngine to retrieve memories from.
Format: `projects/{project}/locations/{location}/reasoningEngines/{reasoning_engine}`com.google.api.gax.rpc.ApiException - if the remote call failspublic final RetrieveMemoriesResponse retrieveMemories(RetrieveMemoriesRequest request)
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (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);
}
request - The request object containing all of the parameters for the API call.com.google.api.gax.rpc.ApiException - if the remote call failspublic final com.google.api.gax.rpc.UnaryCallable<RetrieveMemoriesRequest,RetrieveMemoriesResponse> retrieveMemoriesCallable()
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();
}
public final MemoryBankServiceClient.ListLocationsPagedResponse listLocations(com.google.cloud.location.ListLocationsRequest request)
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (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);
}
}
request - The request object containing all of the parameters for the API call.com.google.api.gax.rpc.ApiException - if the remote call failspublic final com.google.api.gax.rpc.UnaryCallable<com.google.cloud.location.ListLocationsRequest,MemoryBankServiceClient.ListLocationsPagedResponse> listLocationsPagedCallable()
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (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);
}
}
public final com.google.api.gax.rpc.UnaryCallable<com.google.cloud.location.ListLocationsRequest,com.google.cloud.location.ListLocationsResponse> listLocationsCallable()
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (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;
}
}
}
public final com.google.cloud.location.Location getLocation(com.google.cloud.location.GetLocationRequest request)
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (MemoryBankServiceClient memoryBankServiceClient = MemoryBankServiceClient.create()) {
GetLocationRequest request = GetLocationRequest.newBuilder().setName("name3373707").build();
Location response = memoryBankServiceClient.getLocation(request);
}
request - The request object containing all of the parameters for the API call.com.google.api.gax.rpc.ApiException - if the remote call failspublic final com.google.api.gax.rpc.UnaryCallable<com.google.cloud.location.GetLocationRequest,com.google.cloud.location.Location> getLocationCallable()
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (MemoryBankServiceClient memoryBankServiceClient = MemoryBankServiceClient.create()) {
GetLocationRequest request = GetLocationRequest.newBuilder().setName("name3373707").build();
ApiFuture<Location> future =
memoryBankServiceClient.getLocationCallable().futureCall(request);
// Do something.
Location response = future.get();
}
public final com.google.iam.v1.Policy setIamPolicy(com.google.iam.v1.SetIamPolicyRequest request)
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);
}
request - The request object containing all of the parameters for the API call.com.google.api.gax.rpc.ApiException - if the remote call failspublic final com.google.api.gax.rpc.UnaryCallable<com.google.iam.v1.SetIamPolicyRequest,com.google.iam.v1.Policy> setIamPolicyCallable()
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();
}
public final com.google.iam.v1.Policy getIamPolicy(com.google.iam.v1.GetIamPolicyRequest request)
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (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);
}
request - The request object containing all of the parameters for the API call.com.google.api.gax.rpc.ApiException - if the remote call failspublic final com.google.api.gax.rpc.UnaryCallable<com.google.iam.v1.GetIamPolicyRequest,com.google.iam.v1.Policy> getIamPolicyCallable()
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();
}
public final com.google.iam.v1.TestIamPermissionsResponse testIamPermissions(com.google.iam.v1.TestIamPermissionsRequest request)
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);
}
request - The request object containing all of the parameters for the API call.com.google.api.gax.rpc.ApiException - if the remote call failspublic final com.google.api.gax.rpc.UnaryCallable<com.google.iam.v1.TestIamPermissionsRequest,com.google.iam.v1.TestIamPermissionsResponse> testIamPermissionsCallable()
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();
}
public final void close()
close in interface AutoCloseablepublic void shutdown()
shutdown in interface com.google.api.gax.core.BackgroundResourcepublic boolean isShutdown()
isShutdown in interface com.google.api.gax.core.BackgroundResourcepublic boolean isTerminated()
isTerminated in interface com.google.api.gax.core.BackgroundResourcepublic void shutdownNow()
shutdownNow in interface com.google.api.gax.core.BackgroundResourcepublic boolean awaitTermination(long duration,
TimeUnit unit)
throws InterruptedException
awaitTermination in interface com.google.api.gax.core.BackgroundResourceInterruptedExceptionCopyright © 2025 Google LLC. All rights reserved.