@BetaApi @Generated(value="by gapic-generator-java") public class ExampleStoreServiceClient 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 (ExampleStoreServiceClient exampleStoreServiceClient = ExampleStoreServiceClient.create()) {
ExampleStoreName name = ExampleStoreName.of("[PROJECT]", "[LOCATION]", "[EXAMPLE_STORE]");
ExampleStore response = exampleStoreServiceClient.getExampleStore(name);
}
Note: close() needs to be called on the ExampleStoreServiceClient 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 |
|---|---|---|
CreateExampleStore |
Create an ExampleStore. |
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.
|
GetExampleStore |
Get an ExampleStore. |
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.
|
UpdateExampleStore |
Update an ExampleStore. |
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.
|
DeleteExampleStore |
Delete an ExampleStore. |
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.
|
ListExampleStores |
List ExampleStores in a Location. |
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.
|
UpsertExamples |
Create or update Examples in the Example Store. |
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.
|
RemoveExamples |
Remove Examples from the Example Store. |
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.
|
SearchExamples |
Search for similar Examples for given selection criteria. |
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.
|
FetchExamples |
Get Examples from the Example Store. |
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.
|
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 ExampleStoreServiceSettings 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
ExampleStoreServiceSettings exampleStoreServiceSettings =
ExampleStoreServiceSettings.newBuilder()
.setCredentialsProvider(FixedCredentialsProvider.create(myCredentials))
.build();
ExampleStoreServiceClient exampleStoreServiceClient =
ExampleStoreServiceClient.create(exampleStoreServiceSettings);
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
ExampleStoreServiceSettings exampleStoreServiceSettings =
ExampleStoreServiceSettings.newBuilder().setEndpoint(myEndpoint).build();
ExampleStoreServiceClient exampleStoreServiceClient =
ExampleStoreServiceClient.create(exampleStoreServiceSettings);
Please refer to the GitHub repository's samples for more quickstart code snippets.
| Modifier and Type | Class and Description |
|---|---|
static class |
ExampleStoreServiceClient.FetchExamplesFixedSizeCollection |
static class |
ExampleStoreServiceClient.FetchExamplesPage |
static class |
ExampleStoreServiceClient.FetchExamplesPagedResponse |
static class |
ExampleStoreServiceClient.ListExampleStoresFixedSizeCollection |
static class |
ExampleStoreServiceClient.ListExampleStoresPage |
static class |
ExampleStoreServiceClient.ListExampleStoresPagedResponse |
static class |
ExampleStoreServiceClient.ListLocationsFixedSizeCollection |
static class |
ExampleStoreServiceClient.ListLocationsPage |
static class |
ExampleStoreServiceClient.ListLocationsPagedResponse |
| Modifier | Constructor and Description |
|---|---|
protected |
ExampleStoreServiceClient(ExampleStoreServiceSettings settings)
Constructs an instance of ExampleStoreServiceClient, using the given settings.
|
protected |
ExampleStoreServiceClient(ExampleStoreServiceStub stub) |
| Modifier and Type | Method and Description |
|---|---|
boolean |
awaitTermination(long duration,
TimeUnit unit) |
void |
close() |
static ExampleStoreServiceClient |
create()
Constructs an instance of ExampleStoreServiceClient with default settings.
|
static ExampleStoreServiceClient |
create(ExampleStoreServiceSettings settings)
Constructs an instance of ExampleStoreServiceClient, using the given settings.
|
static ExampleStoreServiceClient |
create(ExampleStoreServiceStub stub)
Constructs an instance of ExampleStoreServiceClient, using the given stub for making calls.
|
com.google.api.gax.longrunning.OperationFuture<ExampleStore,CreateExampleStoreOperationMetadata> |
createExampleStoreAsync(CreateExampleStoreRequest request)
Create an ExampleStore.
|
com.google.api.gax.longrunning.OperationFuture<ExampleStore,CreateExampleStoreOperationMetadata> |
createExampleStoreAsync(LocationName parent,
ExampleStore exampleStore)
Create an ExampleStore.
|
com.google.api.gax.longrunning.OperationFuture<ExampleStore,CreateExampleStoreOperationMetadata> |
createExampleStoreAsync(String parent,
ExampleStore exampleStore)
Create an ExampleStore.
|
com.google.api.gax.rpc.UnaryCallable<CreateExampleStoreRequest,com.google.longrunning.Operation> |
createExampleStoreCallable()
Create an ExampleStore.
|
com.google.api.gax.rpc.OperationCallable<CreateExampleStoreRequest,ExampleStore,CreateExampleStoreOperationMetadata> |
createExampleStoreOperationCallable()
Create an ExampleStore.
|
com.google.api.gax.longrunning.OperationFuture<com.google.protobuf.Empty,DeleteExampleStoreOperationMetadata> |
deleteExampleStoreAsync(DeleteExampleStoreRequest request)
Delete an ExampleStore.
|
com.google.api.gax.longrunning.OperationFuture<com.google.protobuf.Empty,DeleteExampleStoreOperationMetadata> |
deleteExampleStoreAsync(ExampleStoreName name)
Delete an ExampleStore.
|
com.google.api.gax.longrunning.OperationFuture<com.google.protobuf.Empty,DeleteExampleStoreOperationMetadata> |
deleteExampleStoreAsync(String name)
Delete an ExampleStore.
|
com.google.api.gax.rpc.UnaryCallable<DeleteExampleStoreRequest,com.google.longrunning.Operation> |
deleteExampleStoreCallable()
Delete an ExampleStore.
|
com.google.api.gax.rpc.OperationCallable<DeleteExampleStoreRequest,com.google.protobuf.Empty,DeleteExampleStoreOperationMetadata> |
deleteExampleStoreOperationCallable()
Delete an ExampleStore.
|
ExampleStoreServiceClient.FetchExamplesPagedResponse |
fetchExamples(FetchExamplesRequest request)
Get Examples from the Example Store.
|
com.google.api.gax.rpc.UnaryCallable<FetchExamplesRequest,FetchExamplesResponse> |
fetchExamplesCallable()
Get Examples from the Example Store.
|
com.google.api.gax.rpc.UnaryCallable<FetchExamplesRequest,ExampleStoreServiceClient.FetchExamplesPagedResponse> |
fetchExamplesPagedCallable()
Get Examples from the Example Store.
|
ExampleStore |
getExampleStore(ExampleStoreName name)
Get an ExampleStore.
|
ExampleStore |
getExampleStore(GetExampleStoreRequest request)
Get an ExampleStore.
|
ExampleStore |
getExampleStore(String name)
Get an ExampleStore.
|
com.google.api.gax.rpc.UnaryCallable<GetExampleStoreRequest,ExampleStore> |
getExampleStoreCallable()
Get an ExampleStore.
|
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.
|
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.
|
ExampleStoreServiceSettings |
getSettings() |
ExampleStoreServiceStub |
getStub() |
boolean |
isShutdown() |
boolean |
isTerminated() |
ExampleStoreServiceClient.ListExampleStoresPagedResponse |
listExampleStores(ListExampleStoresRequest request)
List ExampleStores in a Location.
|
ExampleStoreServiceClient.ListExampleStoresPagedResponse |
listExampleStores(LocationName parent)
List ExampleStores in a Location.
|
ExampleStoreServiceClient.ListExampleStoresPagedResponse |
listExampleStores(String parent)
List ExampleStores in a Location.
|
com.google.api.gax.rpc.UnaryCallable<ListExampleStoresRequest,ListExampleStoresResponse> |
listExampleStoresCallable()
List ExampleStores in a Location.
|
com.google.api.gax.rpc.UnaryCallable<ListExampleStoresRequest,ExampleStoreServiceClient.ListExampleStoresPagedResponse> |
listExampleStoresPagedCallable()
List ExampleStores in a Location.
|
ExampleStoreServiceClient.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,ExampleStoreServiceClient.ListLocationsPagedResponse> |
listLocationsPagedCallable()
Lists information about the supported locations for this service.
|
RemoveExamplesResponse |
removeExamples(RemoveExamplesRequest request)
Remove Examples from the Example Store.
|
com.google.api.gax.rpc.UnaryCallable<RemoveExamplesRequest,RemoveExamplesResponse> |
removeExamplesCallable()
Remove Examples from the Example Store.
|
SearchExamplesResponse |
searchExamples(SearchExamplesRequest request)
Search for similar Examples for given selection criteria.
|
com.google.api.gax.rpc.UnaryCallable<SearchExamplesRequest,SearchExamplesResponse> |
searchExamplesCallable()
Search for similar Examples for given selection criteria.
|
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<ExampleStore,UpdateExampleStoreOperationMetadata> |
updateExampleStoreAsync(ExampleStore exampleStore,
com.google.protobuf.FieldMask updateMask)
Update an ExampleStore.
|
com.google.api.gax.longrunning.OperationFuture<ExampleStore,UpdateExampleStoreOperationMetadata> |
updateExampleStoreAsync(UpdateExampleStoreRequest request)
Update an ExampleStore.
|
com.google.api.gax.rpc.UnaryCallable<UpdateExampleStoreRequest,com.google.longrunning.Operation> |
updateExampleStoreCallable()
Update an ExampleStore.
|
com.google.api.gax.rpc.OperationCallable<UpdateExampleStoreRequest,ExampleStore,UpdateExampleStoreOperationMetadata> |
updateExampleStoreOperationCallable()
Update an ExampleStore.
|
UpsertExamplesResponse |
upsertExamples(UpsertExamplesRequest request)
Create or update Examples in the Example Store.
|
com.google.api.gax.rpc.UnaryCallable<UpsertExamplesRequest,UpsertExamplesResponse> |
upsertExamplesCallable()
Create or update Examples in the Example Store.
|
protected ExampleStoreServiceClient(ExampleStoreServiceSettings settings) throws IOException
IOExceptionprotected ExampleStoreServiceClient(ExampleStoreServiceStub stub)
public static final ExampleStoreServiceClient create() throws IOException
IOExceptionpublic static final ExampleStoreServiceClient create(ExampleStoreServiceSettings settings) throws IOException
IOExceptionpublic static final ExampleStoreServiceClient create(ExampleStoreServiceStub stub)
public final ExampleStoreServiceSettings getSettings()
public ExampleStoreServiceStub getStub()
public final com.google.longrunning.OperationsClient getOperationsClient()
public final com.google.api.gax.longrunning.OperationFuture<ExampleStore,CreateExampleStoreOperationMetadata> createExampleStoreAsync(LocationName parent, ExampleStore exampleStore)
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 (ExampleStoreServiceClient exampleStoreServiceClient = ExampleStoreServiceClient.create()) {
LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]");
ExampleStore exampleStore = ExampleStore.newBuilder().build();
ExampleStore response =
exampleStoreServiceClient.createExampleStoreAsync(parent, exampleStore).get();
}
parent - Required. The resource name of the Location to create the ExampleStore in.
Format: `projects/{project}/locations/{location}`exampleStore - Required. The Example Store to be created.com.google.api.gax.rpc.ApiException - if the remote call failspublic final com.google.api.gax.longrunning.OperationFuture<ExampleStore,CreateExampleStoreOperationMetadata> createExampleStoreAsync(String parent, ExampleStore exampleStore)
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 (ExampleStoreServiceClient exampleStoreServiceClient = ExampleStoreServiceClient.create()) {
String parent = LocationName.of("[PROJECT]", "[LOCATION]").toString();
ExampleStore exampleStore = ExampleStore.newBuilder().build();
ExampleStore response =
exampleStoreServiceClient.createExampleStoreAsync(parent, exampleStore).get();
}
parent - Required. The resource name of the Location to create the ExampleStore in.
Format: `projects/{project}/locations/{location}`exampleStore - Required. The Example Store to be created.com.google.api.gax.rpc.ApiException - if the remote call failspublic final com.google.api.gax.longrunning.OperationFuture<ExampleStore,CreateExampleStoreOperationMetadata> createExampleStoreAsync(CreateExampleStoreRequest 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 (ExampleStoreServiceClient exampleStoreServiceClient = ExampleStoreServiceClient.create()) {
CreateExampleStoreRequest request =
CreateExampleStoreRequest.newBuilder()
.setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString())
.setExampleStore(ExampleStore.newBuilder().build())
.build();
ExampleStore response = exampleStoreServiceClient.createExampleStoreAsync(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<CreateExampleStoreRequest,ExampleStore,CreateExampleStoreOperationMetadata> createExampleStoreOperationCallable()
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 (ExampleStoreServiceClient exampleStoreServiceClient = ExampleStoreServiceClient.create()) {
CreateExampleStoreRequest request =
CreateExampleStoreRequest.newBuilder()
.setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString())
.setExampleStore(ExampleStore.newBuilder().build())
.build();
OperationFuture<ExampleStore, CreateExampleStoreOperationMetadata> future =
exampleStoreServiceClient.createExampleStoreOperationCallable().futureCall(request);
// Do something.
ExampleStore response = future.get();
}
public final com.google.api.gax.rpc.UnaryCallable<CreateExampleStoreRequest,com.google.longrunning.Operation> createExampleStoreCallable()
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 (ExampleStoreServiceClient exampleStoreServiceClient = ExampleStoreServiceClient.create()) {
CreateExampleStoreRequest request =
CreateExampleStoreRequest.newBuilder()
.setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString())
.setExampleStore(ExampleStore.newBuilder().build())
.build();
ApiFuture<Operation> future =
exampleStoreServiceClient.createExampleStoreCallable().futureCall(request);
// Do something.
Operation response = future.get();
}
public final ExampleStore getExampleStore(ExampleStoreName 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 (ExampleStoreServiceClient exampleStoreServiceClient = ExampleStoreServiceClient.create()) {
ExampleStoreName name = ExampleStoreName.of("[PROJECT]", "[LOCATION]", "[EXAMPLE_STORE]");
ExampleStore response = exampleStoreServiceClient.getExampleStore(name);
}
name - Required. The resource name of the ExampleStore. Format:
`projects/{project}/locations/{location}/exampleStores/{example_store}`com.google.api.gax.rpc.ApiException - if the remote call failspublic final ExampleStore getExampleStore(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 (ExampleStoreServiceClient exampleStoreServiceClient = ExampleStoreServiceClient.create()) {
String name = ExampleStoreName.of("[PROJECT]", "[LOCATION]", "[EXAMPLE_STORE]").toString();
ExampleStore response = exampleStoreServiceClient.getExampleStore(name);
}
name - Required. The resource name of the ExampleStore. Format:
`projects/{project}/locations/{location}/exampleStores/{example_store}`com.google.api.gax.rpc.ApiException - if the remote call failspublic final ExampleStore getExampleStore(GetExampleStoreRequest 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 (ExampleStoreServiceClient exampleStoreServiceClient = ExampleStoreServiceClient.create()) {
GetExampleStoreRequest request =
GetExampleStoreRequest.newBuilder()
.setName(ExampleStoreName.of("[PROJECT]", "[LOCATION]", "[EXAMPLE_STORE]").toString())
.build();
ExampleStore response = exampleStoreServiceClient.getExampleStore(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<GetExampleStoreRequest,ExampleStore> getExampleStoreCallable()
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 (ExampleStoreServiceClient exampleStoreServiceClient = ExampleStoreServiceClient.create()) {
GetExampleStoreRequest request =
GetExampleStoreRequest.newBuilder()
.setName(ExampleStoreName.of("[PROJECT]", "[LOCATION]", "[EXAMPLE_STORE]").toString())
.build();
ApiFuture<ExampleStore> future =
exampleStoreServiceClient.getExampleStoreCallable().futureCall(request);
// Do something.
ExampleStore response = future.get();
}
public final com.google.api.gax.longrunning.OperationFuture<ExampleStore,UpdateExampleStoreOperationMetadata> updateExampleStoreAsync(ExampleStore exampleStore, 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 (ExampleStoreServiceClient exampleStoreServiceClient = ExampleStoreServiceClient.create()) {
ExampleStore exampleStore = ExampleStore.newBuilder().build();
FieldMask updateMask = FieldMask.newBuilder().build();
ExampleStore response =
exampleStoreServiceClient.updateExampleStoreAsync(exampleStore, updateMask).get();
}
exampleStore - Required. The Example Store which replaces the resource on the server.updateMask - Optional. Mask specifying which fields to update. Supported fields:
* `display_name` * `description`
com.google.api.gax.rpc.ApiException - if the remote call failspublic final com.google.api.gax.longrunning.OperationFuture<ExampleStore,UpdateExampleStoreOperationMetadata> updateExampleStoreAsync(UpdateExampleStoreRequest 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 (ExampleStoreServiceClient exampleStoreServiceClient = ExampleStoreServiceClient.create()) {
UpdateExampleStoreRequest request =
UpdateExampleStoreRequest.newBuilder()
.setExampleStore(ExampleStore.newBuilder().build())
.setUpdateMask(FieldMask.newBuilder().build())
.build();
ExampleStore response = exampleStoreServiceClient.updateExampleStoreAsync(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<UpdateExampleStoreRequest,ExampleStore,UpdateExampleStoreOperationMetadata> updateExampleStoreOperationCallable()
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 (ExampleStoreServiceClient exampleStoreServiceClient = ExampleStoreServiceClient.create()) {
UpdateExampleStoreRequest request =
UpdateExampleStoreRequest.newBuilder()
.setExampleStore(ExampleStore.newBuilder().build())
.setUpdateMask(FieldMask.newBuilder().build())
.build();
OperationFuture<ExampleStore, UpdateExampleStoreOperationMetadata> future =
exampleStoreServiceClient.updateExampleStoreOperationCallable().futureCall(request);
// Do something.
ExampleStore response = future.get();
}
public final com.google.api.gax.rpc.UnaryCallable<UpdateExampleStoreRequest,com.google.longrunning.Operation> updateExampleStoreCallable()
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 (ExampleStoreServiceClient exampleStoreServiceClient = ExampleStoreServiceClient.create()) {
UpdateExampleStoreRequest request =
UpdateExampleStoreRequest.newBuilder()
.setExampleStore(ExampleStore.newBuilder().build())
.setUpdateMask(FieldMask.newBuilder().build())
.build();
ApiFuture<Operation> future =
exampleStoreServiceClient.updateExampleStoreCallable().futureCall(request);
// Do something.
Operation response = future.get();
}
public final com.google.api.gax.longrunning.OperationFuture<com.google.protobuf.Empty,DeleteExampleStoreOperationMetadata> deleteExampleStoreAsync(ExampleStoreName 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 (ExampleStoreServiceClient exampleStoreServiceClient = ExampleStoreServiceClient.create()) {
ExampleStoreName name = ExampleStoreName.of("[PROJECT]", "[LOCATION]", "[EXAMPLE_STORE]");
exampleStoreServiceClient.deleteExampleStoreAsync(name).get();
}
name - Required. The resource name of the ExampleStore to be deleted. Format:
`projects/{project}/locations/{location}/exampleStores/{example_store}`com.google.api.gax.rpc.ApiException - if the remote call failspublic final com.google.api.gax.longrunning.OperationFuture<com.google.protobuf.Empty,DeleteExampleStoreOperationMetadata> deleteExampleStoreAsync(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 (ExampleStoreServiceClient exampleStoreServiceClient = ExampleStoreServiceClient.create()) {
String name = ExampleStoreName.of("[PROJECT]", "[LOCATION]", "[EXAMPLE_STORE]").toString();
exampleStoreServiceClient.deleteExampleStoreAsync(name).get();
}
name - Required. The resource name of the ExampleStore to be deleted. Format:
`projects/{project}/locations/{location}/exampleStores/{example_store}`com.google.api.gax.rpc.ApiException - if the remote call failspublic final com.google.api.gax.longrunning.OperationFuture<com.google.protobuf.Empty,DeleteExampleStoreOperationMetadata> deleteExampleStoreAsync(DeleteExampleStoreRequest 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 (ExampleStoreServiceClient exampleStoreServiceClient = ExampleStoreServiceClient.create()) {
DeleteExampleStoreRequest request =
DeleteExampleStoreRequest.newBuilder()
.setName(ExampleStoreName.of("[PROJECT]", "[LOCATION]", "[EXAMPLE_STORE]").toString())
.build();
exampleStoreServiceClient.deleteExampleStoreAsync(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<DeleteExampleStoreRequest,com.google.protobuf.Empty,DeleteExampleStoreOperationMetadata> deleteExampleStoreOperationCallable()
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 (ExampleStoreServiceClient exampleStoreServiceClient = ExampleStoreServiceClient.create()) {
DeleteExampleStoreRequest request =
DeleteExampleStoreRequest.newBuilder()
.setName(ExampleStoreName.of("[PROJECT]", "[LOCATION]", "[EXAMPLE_STORE]").toString())
.build();
OperationFuture<Empty, DeleteExampleStoreOperationMetadata> future =
exampleStoreServiceClient.deleteExampleStoreOperationCallable().futureCall(request);
// Do something.
future.get();
}
public final com.google.api.gax.rpc.UnaryCallable<DeleteExampleStoreRequest,com.google.longrunning.Operation> deleteExampleStoreCallable()
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 (ExampleStoreServiceClient exampleStoreServiceClient = ExampleStoreServiceClient.create()) {
DeleteExampleStoreRequest request =
DeleteExampleStoreRequest.newBuilder()
.setName(ExampleStoreName.of("[PROJECT]", "[LOCATION]", "[EXAMPLE_STORE]").toString())
.build();
ApiFuture<Operation> future =
exampleStoreServiceClient.deleteExampleStoreCallable().futureCall(request);
// Do something.
future.get();
}
public final ExampleStoreServiceClient.ListExampleStoresPagedResponse listExampleStores(LocationName 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 (ExampleStoreServiceClient exampleStoreServiceClient = ExampleStoreServiceClient.create()) {
LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]");
for (ExampleStore element :
exampleStoreServiceClient.listExampleStores(parent).iterateAll()) {
// doThingsWith(element);
}
}
parent - Required. The resource name of the Location to list the ExampleStores from.
Format: `projects/{project}/locations/{location}`com.google.api.gax.rpc.ApiException - if the remote call failspublic final ExampleStoreServiceClient.ListExampleStoresPagedResponse listExampleStores(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 (ExampleStoreServiceClient exampleStoreServiceClient = ExampleStoreServiceClient.create()) {
String parent = LocationName.of("[PROJECT]", "[LOCATION]").toString();
for (ExampleStore element :
exampleStoreServiceClient.listExampleStores(parent).iterateAll()) {
// doThingsWith(element);
}
}
parent - Required. The resource name of the Location to list the ExampleStores from.
Format: `projects/{project}/locations/{location}`com.google.api.gax.rpc.ApiException - if the remote call failspublic final ExampleStoreServiceClient.ListExampleStoresPagedResponse listExampleStores(ListExampleStoresRequest 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 (ExampleStoreServiceClient exampleStoreServiceClient = ExampleStoreServiceClient.create()) {
ListExampleStoresRequest request =
ListExampleStoresRequest.newBuilder()
.setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString())
.setFilter("filter-1274492040")
.setPageSize(883849137)
.setPageToken("pageToken873572522")
.build();
for (ExampleStore element :
exampleStoreServiceClient.listExampleStores(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<ListExampleStoresRequest,ExampleStoreServiceClient.ListExampleStoresPagedResponse> listExampleStoresPagedCallable()
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 (ExampleStoreServiceClient exampleStoreServiceClient = ExampleStoreServiceClient.create()) {
ListExampleStoresRequest request =
ListExampleStoresRequest.newBuilder()
.setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString())
.setFilter("filter-1274492040")
.setPageSize(883849137)
.setPageToken("pageToken873572522")
.build();
ApiFuture<ExampleStore> future =
exampleStoreServiceClient.listExampleStoresPagedCallable().futureCall(request);
// Do something.
for (ExampleStore element : future.get().iterateAll()) {
// doThingsWith(element);
}
}
public final com.google.api.gax.rpc.UnaryCallable<ListExampleStoresRequest,ListExampleStoresResponse> listExampleStoresCallable()
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 (ExampleStoreServiceClient exampleStoreServiceClient = ExampleStoreServiceClient.create()) {
ListExampleStoresRequest request =
ListExampleStoresRequest.newBuilder()
.setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString())
.setFilter("filter-1274492040")
.setPageSize(883849137)
.setPageToken("pageToken873572522")
.build();
while (true) {
ListExampleStoresResponse response =
exampleStoreServiceClient.listExampleStoresCallable().call(request);
for (ExampleStore element : response.getExampleStoresList()) {
// doThingsWith(element);
}
String nextPageToken = response.getNextPageToken();
if (!Strings.isNullOrEmpty(nextPageToken)) {
request = request.toBuilder().setPageToken(nextPageToken).build();
} else {
break;
}
}
}
public final UpsertExamplesResponse upsertExamples(UpsertExamplesRequest 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 (ExampleStoreServiceClient exampleStoreServiceClient = ExampleStoreServiceClient.create()) {
UpsertExamplesRequest request =
UpsertExamplesRequest.newBuilder()
.setExampleStore(
ExampleStoreName.of("[PROJECT]", "[LOCATION]", "[EXAMPLE_STORE]").toString())
.addAllExamples(new ArrayList<Example>())
.setOverwrite(true)
.build();
UpsertExamplesResponse response = exampleStoreServiceClient.upsertExamples(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<UpsertExamplesRequest,UpsertExamplesResponse> upsertExamplesCallable()
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 (ExampleStoreServiceClient exampleStoreServiceClient = ExampleStoreServiceClient.create()) {
UpsertExamplesRequest request =
UpsertExamplesRequest.newBuilder()
.setExampleStore(
ExampleStoreName.of("[PROJECT]", "[LOCATION]", "[EXAMPLE_STORE]").toString())
.addAllExamples(new ArrayList<Example>())
.setOverwrite(true)
.build();
ApiFuture<UpsertExamplesResponse> future =
exampleStoreServiceClient.upsertExamplesCallable().futureCall(request);
// Do something.
UpsertExamplesResponse response = future.get();
}
public final RemoveExamplesResponse removeExamples(RemoveExamplesRequest 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 (ExampleStoreServiceClient exampleStoreServiceClient = ExampleStoreServiceClient.create()) {
RemoveExamplesRequest request =
RemoveExamplesRequest.newBuilder()
.setExampleStore(
ExampleStoreName.of("[PROJECT]", "[LOCATION]", "[EXAMPLE_STORE]").toString())
.addAllExampleIds(new ArrayList<String>())
.build();
RemoveExamplesResponse response = exampleStoreServiceClient.removeExamples(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<RemoveExamplesRequest,RemoveExamplesResponse> removeExamplesCallable()
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 (ExampleStoreServiceClient exampleStoreServiceClient = ExampleStoreServiceClient.create()) {
RemoveExamplesRequest request =
RemoveExamplesRequest.newBuilder()
.setExampleStore(
ExampleStoreName.of("[PROJECT]", "[LOCATION]", "[EXAMPLE_STORE]").toString())
.addAllExampleIds(new ArrayList<String>())
.build();
ApiFuture<RemoveExamplesResponse> future =
exampleStoreServiceClient.removeExamplesCallable().futureCall(request);
// Do something.
RemoveExamplesResponse response = future.get();
}
public final SearchExamplesResponse searchExamples(SearchExamplesRequest 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 (ExampleStoreServiceClient exampleStoreServiceClient = ExampleStoreServiceClient.create()) {
SearchExamplesRequest request =
SearchExamplesRequest.newBuilder()
.setExampleStore(
ExampleStoreName.of("[PROJECT]", "[LOCATION]", "[EXAMPLE_STORE]").toString())
.setTopK(110545921)
.build();
SearchExamplesResponse response = exampleStoreServiceClient.searchExamples(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<SearchExamplesRequest,SearchExamplesResponse> searchExamplesCallable()
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 (ExampleStoreServiceClient exampleStoreServiceClient = ExampleStoreServiceClient.create()) {
SearchExamplesRequest request =
SearchExamplesRequest.newBuilder()
.setExampleStore(
ExampleStoreName.of("[PROJECT]", "[LOCATION]", "[EXAMPLE_STORE]").toString())
.setTopK(110545921)
.build();
ApiFuture<SearchExamplesResponse> future =
exampleStoreServiceClient.searchExamplesCallable().futureCall(request);
// Do something.
SearchExamplesResponse response = future.get();
}
public final ExampleStoreServiceClient.FetchExamplesPagedResponse fetchExamples(FetchExamplesRequest 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 (ExampleStoreServiceClient exampleStoreServiceClient = ExampleStoreServiceClient.create()) {
FetchExamplesRequest request =
FetchExamplesRequest.newBuilder()
.setExampleStore(
ExampleStoreName.of("[PROJECT]", "[LOCATION]", "[EXAMPLE_STORE]").toString())
.setPageSize(883849137)
.setPageToken("pageToken873572522")
.addAllExampleIds(new ArrayList<String>())
.build();
for (Example element : exampleStoreServiceClient.fetchExamples(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<FetchExamplesRequest,ExampleStoreServiceClient.FetchExamplesPagedResponse> fetchExamplesPagedCallable()
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 (ExampleStoreServiceClient exampleStoreServiceClient = ExampleStoreServiceClient.create()) {
FetchExamplesRequest request =
FetchExamplesRequest.newBuilder()
.setExampleStore(
ExampleStoreName.of("[PROJECT]", "[LOCATION]", "[EXAMPLE_STORE]").toString())
.setPageSize(883849137)
.setPageToken("pageToken873572522")
.addAllExampleIds(new ArrayList<String>())
.build();
ApiFuture<Example> future =
exampleStoreServiceClient.fetchExamplesPagedCallable().futureCall(request);
// Do something.
for (Example element : future.get().iterateAll()) {
// doThingsWith(element);
}
}
public final com.google.api.gax.rpc.UnaryCallable<FetchExamplesRequest,FetchExamplesResponse> fetchExamplesCallable()
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 (ExampleStoreServiceClient exampleStoreServiceClient = ExampleStoreServiceClient.create()) {
FetchExamplesRequest request =
FetchExamplesRequest.newBuilder()
.setExampleStore(
ExampleStoreName.of("[PROJECT]", "[LOCATION]", "[EXAMPLE_STORE]").toString())
.setPageSize(883849137)
.setPageToken("pageToken873572522")
.addAllExampleIds(new ArrayList<String>())
.build();
while (true) {
FetchExamplesResponse response =
exampleStoreServiceClient.fetchExamplesCallable().call(request);
for (Example element : response.getExamplesList()) {
// doThingsWith(element);
}
String nextPageToken = response.getNextPageToken();
if (!Strings.isNullOrEmpty(nextPageToken)) {
request = request.toBuilder().setPageToken(nextPageToken).build();
} else {
break;
}
}
}
public final ExampleStoreServiceClient.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 (ExampleStoreServiceClient exampleStoreServiceClient = ExampleStoreServiceClient.create()) {
ListLocationsRequest request =
ListLocationsRequest.newBuilder()
.setName("name3373707")
.setFilter("filter-1274492040")
.setPageSize(883849137)
.setPageToken("pageToken873572522")
.build();
for (Location element : exampleStoreServiceClient.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,ExampleStoreServiceClient.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 (ExampleStoreServiceClient exampleStoreServiceClient = ExampleStoreServiceClient.create()) {
ListLocationsRequest request =
ListLocationsRequest.newBuilder()
.setName("name3373707")
.setFilter("filter-1274492040")
.setPageSize(883849137)
.setPageToken("pageToken873572522")
.build();
ApiFuture<Location> future =
exampleStoreServiceClient.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 (ExampleStoreServiceClient exampleStoreServiceClient = ExampleStoreServiceClient.create()) {
ListLocationsRequest request =
ListLocationsRequest.newBuilder()
.setName("name3373707")
.setFilter("filter-1274492040")
.setPageSize(883849137)
.setPageToken("pageToken873572522")
.build();
while (true) {
ListLocationsResponse response =
exampleStoreServiceClient.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 (ExampleStoreServiceClient exampleStoreServiceClient = ExampleStoreServiceClient.create()) {
GetLocationRequest request = GetLocationRequest.newBuilder().setName("name3373707").build();
Location response = exampleStoreServiceClient.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 (ExampleStoreServiceClient exampleStoreServiceClient = ExampleStoreServiceClient.create()) {
GetLocationRequest request = GetLocationRequest.newBuilder().setName("name3373707").build();
ApiFuture<Location> future =
exampleStoreServiceClient.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 (ExampleStoreServiceClient exampleStoreServiceClient = ExampleStoreServiceClient.create()) {
SetIamPolicyRequest request =
SetIamPolicyRequest.newBuilder()
.setResource(
EndpointName.ofProjectLocationEndpointName(
"[PROJECT]", "[LOCATION]", "[ENDPOINT]")
.toString())
.setPolicy(Policy.newBuilder().build())
.setUpdateMask(FieldMask.newBuilder().build())
.build();
Policy response = exampleStoreServiceClient.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 (ExampleStoreServiceClient exampleStoreServiceClient = ExampleStoreServiceClient.create()) {
SetIamPolicyRequest request =
SetIamPolicyRequest.newBuilder()
.setResource(
EndpointName.ofProjectLocationEndpointName(
"[PROJECT]", "[LOCATION]", "[ENDPOINT]")
.toString())
.setPolicy(Policy.newBuilder().build())
.setUpdateMask(FieldMask.newBuilder().build())
.build();
ApiFuture<Policy> future =
exampleStoreServiceClient.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 (ExampleStoreServiceClient exampleStoreServiceClient = ExampleStoreServiceClient.create()) {
GetIamPolicyRequest request =
GetIamPolicyRequest.newBuilder()
.setResource(
EndpointName.ofProjectLocationEndpointName(
"[PROJECT]", "[LOCATION]", "[ENDPOINT]")
.toString())
.setOptions(GetPolicyOptions.newBuilder().build())
.build();
Policy response = exampleStoreServiceClient.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 (ExampleStoreServiceClient exampleStoreServiceClient = ExampleStoreServiceClient.create()) {
GetIamPolicyRequest request =
GetIamPolicyRequest.newBuilder()
.setResource(
EndpointName.ofProjectLocationEndpointName(
"[PROJECT]", "[LOCATION]", "[ENDPOINT]")
.toString())
.setOptions(GetPolicyOptions.newBuilder().build())
.build();
ApiFuture<Policy> future =
exampleStoreServiceClient.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 (ExampleStoreServiceClient exampleStoreServiceClient = ExampleStoreServiceClient.create()) {
TestIamPermissionsRequest request =
TestIamPermissionsRequest.newBuilder()
.setResource(
EndpointName.ofProjectLocationEndpointName(
"[PROJECT]", "[LOCATION]", "[ENDPOINT]")
.toString())
.addAllPermissions(new ArrayList<String>())
.build();
TestIamPermissionsResponse response = exampleStoreServiceClient.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 (ExampleStoreServiceClient exampleStoreServiceClient = ExampleStoreServiceClient.create()) {
TestIamPermissionsRequest request =
TestIamPermissionsRequest.newBuilder()
.setResource(
EndpointName.ofProjectLocationEndpointName(
"[PROJECT]", "[LOCATION]", "[ENDPOINT]")
.toString())
.addAllPermissions(new ArrayList<String>())
.build();
ApiFuture<TestIamPermissionsResponse> future =
exampleStoreServiceClient.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.