Class ExampleStoreServiceClient
- All Implemented Interfaces:
BackgroundResource,AutoCloseable
This class provides the ability to make remote calls to the backing service through method calls that map to API methods. Sample code to get started:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (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.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classstatic classstatic classstatic classstatic classstatic classstatic classstatic classstatic class -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedConstructs an instance of ExampleStoreServiceClient, using the given settings.protected -
Method Summary
Modifier and TypeMethodDescriptionbooleanawaitTermination(long duration, TimeUnit unit) final voidclose()static final ExampleStoreServiceClientcreate()Constructs an instance of ExampleStoreServiceClient with default settings.static final ExampleStoreServiceClientcreate(ExampleStoreServiceSettings settings) Constructs an instance of ExampleStoreServiceClient, using the given settings.static final ExampleStoreServiceClientConstructs an instance of ExampleStoreServiceClient, using the given stub for making calls.Create an ExampleStore.createExampleStoreAsync(LocationName parent, ExampleStore exampleStore) Create an ExampleStore.createExampleStoreAsync(String parent, ExampleStore exampleStore) Create an ExampleStore.Create an ExampleStore.Create an ExampleStore.final OperationFuture<com.google.protobuf.Empty,DeleteExampleStoreOperationMetadata> Delete an ExampleStore.final OperationFuture<com.google.protobuf.Empty,DeleteExampleStoreOperationMetadata> Delete an ExampleStore.final OperationFuture<com.google.protobuf.Empty,DeleteExampleStoreOperationMetadata> Delete an ExampleStore.Delete an ExampleStore.final OperationCallable<DeleteExampleStoreRequest,com.google.protobuf.Empty, DeleteExampleStoreOperationMetadata> Delete an ExampleStore.fetchExamples(FetchExamplesRequest request) Get Examples from the Example Store.Get Examples from the Example Store.Get Examples from the Example Store.final ExampleStoreGet an ExampleStore.final ExampleStoregetExampleStore(GetExampleStoreRequest request) Get an ExampleStore.final ExampleStoregetExampleStore(String name) Get an ExampleStore.Get an ExampleStore.final PolicygetIamPolicy(GetIamPolicyRequest request) Gets the access control policy for a resource.Gets the access control policy for a resource.final LocationgetLocation(GetLocationRequest request) Gets information about a location.Gets information about a location.final OperationsClientReturns the OperationsClient that can be used to query the status of a long-running operation returned by another API method call.getStub()booleanbooleanList ExampleStores in a Location.listExampleStores(LocationName parent) List ExampleStores in a Location.listExampleStores(String parent) List ExampleStores in a Location.List ExampleStores in a Location.final UnaryCallable<ListExampleStoresRequest,ExampleStoreServiceClient.ListExampleStoresPagedResponse> List ExampleStores in a Location.listLocations(ListLocationsRequest request) Lists information about the supported locations for this service.Lists information about the supported locations for this service.Lists information about the supported locations for this service.final RemoveExamplesResponseremoveExamples(RemoveExamplesRequest request) Remove Examples from the Example Store.Remove Examples from the Example Store.final SearchExamplesResponsesearchExamples(SearchExamplesRequest request) Search for similar Examples for given selection criteria.Search for similar Examples for given selection criteria.final PolicysetIamPolicy(SetIamPolicyRequest request) Sets the access control policy on the specified resource.Sets the access control policy on the specified resource.voidshutdown()voidReturns permissions that a caller has on the specified resource.Returns permissions that a caller has on the specified resource.updateExampleStoreAsync(ExampleStore exampleStore, com.google.protobuf.FieldMask updateMask) Update an ExampleStore.Update an ExampleStore.Update an ExampleStore.Update an ExampleStore.final UpsertExamplesResponseupsertExamples(UpsertExamplesRequest request) Create or update Examples in the Example Store.Create or update Examples in the Example Store.
-
Constructor Details
-
ExampleStoreServiceClient
Constructs an instance of ExampleStoreServiceClient, using the given settings. This is protected so that it is easy to make a subclass, but otherwise, the static factory methods should be preferred.- Throws:
IOException
-
ExampleStoreServiceClient
-
-
Method Details
-
create
Constructs an instance of ExampleStoreServiceClient with default settings.- Throws:
IOException
-
create
public static final ExampleStoreServiceClient create(ExampleStoreServiceSettings settings) throws IOException Constructs an instance of ExampleStoreServiceClient, using the given settings. The channels are created based on the settings passed in, or defaults for any settings that are not set.- Throws:
IOException
-
create
Constructs an instance of ExampleStoreServiceClient, using the given stub for making calls. This is for advanced usage - prefer using create(ExampleStoreServiceSettings). -
getSettings
-
getStub
-
getOperationsClient
Returns the OperationsClient that can be used to query the status of a long-running operation returned by another API method call. -
createExampleStoreAsync
public final OperationFuture<ExampleStore,CreateExampleStoreOperationMetadata> createExampleStoreAsync(LocationName parent, ExampleStore exampleStore) Create an 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(); }- Parameters:
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.- Throws:
ApiException- if the remote call fails
-
createExampleStoreAsync
public final OperationFuture<ExampleStore,CreateExampleStoreOperationMetadata> createExampleStoreAsync(String parent, ExampleStore exampleStore) Create an 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(); }- Parameters:
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.- Throws:
ApiException- if the remote call fails
-
createExampleStoreAsync
public final OperationFuture<ExampleStore,CreateExampleStoreOperationMetadata> createExampleStoreAsync(CreateExampleStoreRequest request) Create an 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()) { CreateExampleStoreRequest request = CreateExampleStoreRequest.newBuilder() .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString()) .setExampleStore(ExampleStore.newBuilder().build()) .build(); ExampleStore response = exampleStoreServiceClient.createExampleStoreAsync(request).get(); }- Parameters:
request- The request object containing all of the parameters for the API call.- Throws:
ApiException- if the remote call fails
-
createExampleStoreOperationCallable
public final OperationCallable<CreateExampleStoreRequest,ExampleStore, createExampleStoreOperationCallable()CreateExampleStoreOperationMetadata> Create an 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()) { 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(); } -
createExampleStoreCallable
Create an 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()) { 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(); } -
getExampleStore
Get an 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()) { ExampleStoreName name = ExampleStoreName.of("[PROJECT]", "[LOCATION]", "[EXAMPLE_STORE]"); ExampleStore response = exampleStoreServiceClient.getExampleStore(name); }- Parameters:
name- Required. The resource name of the ExampleStore. Format: `projects/{project}/locations/{location}/exampleStores/{example_store}`- Throws:
ApiException- if the remote call fails
-
getExampleStore
Get an 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 name = ExampleStoreName.of("[PROJECT]", "[LOCATION]", "[EXAMPLE_STORE]").toString(); ExampleStore response = exampleStoreServiceClient.getExampleStore(name); }- Parameters:
name- Required. The resource name of the ExampleStore. Format: `projects/{project}/locations/{location}/exampleStores/{example_store}`- Throws:
ApiException- if the remote call fails
-
getExampleStore
Get an 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()) { GetExampleStoreRequest request = GetExampleStoreRequest.newBuilder() .setName(ExampleStoreName.of("[PROJECT]", "[LOCATION]", "[EXAMPLE_STORE]").toString()) .build(); ExampleStore response = exampleStoreServiceClient.getExampleStore(request); }- Parameters:
request- The request object containing all of the parameters for the API call.- Throws:
ApiException- if the remote call fails
-
getExampleStoreCallable
Get an 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()) { 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(); } -
updateExampleStoreAsync
public final OperationFuture<ExampleStore,UpdateExampleStoreOperationMetadata> updateExampleStoreAsync(ExampleStore exampleStore, com.google.protobuf.FieldMask updateMask) Update an 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()) { ExampleStore exampleStore = ExampleStore.newBuilder().build(); FieldMask updateMask = FieldMask.newBuilder().build(); ExampleStore response = exampleStoreServiceClient.updateExampleStoreAsync(exampleStore, updateMask).get(); }- Parameters:
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`
- Throws:
ApiException- if the remote call fails
-
updateExampleStoreAsync
public final OperationFuture<ExampleStore,UpdateExampleStoreOperationMetadata> updateExampleStoreAsync(UpdateExampleStoreRequest request) Update an 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()) { UpdateExampleStoreRequest request = UpdateExampleStoreRequest.newBuilder() .setExampleStore(ExampleStore.newBuilder().build()) .setUpdateMask(FieldMask.newBuilder().build()) .build(); ExampleStore response = exampleStoreServiceClient.updateExampleStoreAsync(request).get(); }- Parameters:
request- The request object containing all of the parameters for the API call.- Throws:
ApiException- if the remote call fails
-
updateExampleStoreOperationCallable
public final OperationCallable<UpdateExampleStoreRequest,ExampleStore, updateExampleStoreOperationCallable()UpdateExampleStoreOperationMetadata> Update an 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()) { 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(); } -
updateExampleStoreCallable
Update an 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()) { 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(); } -
deleteExampleStoreAsync
public final OperationFuture<com.google.protobuf.Empty,DeleteExampleStoreOperationMetadata> deleteExampleStoreAsync(ExampleStoreName name) Delete an 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()) { ExampleStoreName name = ExampleStoreName.of("[PROJECT]", "[LOCATION]", "[EXAMPLE_STORE]"); exampleStoreServiceClient.deleteExampleStoreAsync(name).get(); }- Parameters:
name- Required. The resource name of the ExampleStore to be deleted. Format: `projects/{project}/locations/{location}/exampleStores/{example_store}`- Throws:
ApiException- if the remote call fails
-
deleteExampleStoreAsync
public final OperationFuture<com.google.protobuf.Empty,DeleteExampleStoreOperationMetadata> deleteExampleStoreAsync(String name) Delete an 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 name = ExampleStoreName.of("[PROJECT]", "[LOCATION]", "[EXAMPLE_STORE]").toString(); exampleStoreServiceClient.deleteExampleStoreAsync(name).get(); }- Parameters:
name- Required. The resource name of the ExampleStore to be deleted. Format: `projects/{project}/locations/{location}/exampleStores/{example_store}`- Throws:
ApiException- if the remote call fails
-
deleteExampleStoreAsync
public final OperationFuture<com.google.protobuf.Empty,DeleteExampleStoreOperationMetadata> deleteExampleStoreAsync(DeleteExampleStoreRequest request) Delete an 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()) { DeleteExampleStoreRequest request = DeleteExampleStoreRequest.newBuilder() .setName(ExampleStoreName.of("[PROJECT]", "[LOCATION]", "[EXAMPLE_STORE]").toString()) .build(); exampleStoreServiceClient.deleteExampleStoreAsync(request).get(); }- Parameters:
request- The request object containing all of the parameters for the API call.- Throws:
ApiException- if the remote call fails
-
deleteExampleStoreOperationCallable
public final OperationCallable<DeleteExampleStoreRequest,com.google.protobuf.Empty, deleteExampleStoreOperationCallable()DeleteExampleStoreOperationMetadata> Delete an 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()) { 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(); } -
deleteExampleStoreCallable
Delete an 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()) { DeleteExampleStoreRequest request = DeleteExampleStoreRequest.newBuilder() .setName(ExampleStoreName.of("[PROJECT]", "[LOCATION]", "[EXAMPLE_STORE]").toString()) .build(); ApiFuture<Operation> future = exampleStoreServiceClient.deleteExampleStoreCallable().futureCall(request); // Do something. future.get(); } -
listExampleStores
public final ExampleStoreServiceClient.ListExampleStoresPagedResponse listExampleStores(LocationName parent) List ExampleStores in a Location.Sample code:
// This snippet has been automatically generated and should be regarded as a code template only. // It will require modifications to work: // - It may require correct/in-range values for request initialization. // - It may require specifying regional endpoints when creating the service client as shown in // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library try (ExampleStoreServiceClient exampleStoreServiceClient = ExampleStoreServiceClient.create()) { LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]"); for (ExampleStore element : exampleStoreServiceClient.listExampleStores(parent).iterateAll()) { // doThingsWith(element); } }- Parameters:
parent- Required. The resource name of the Location to list the ExampleStores from. Format: `projects/{project}/locations/{location}`- Throws:
ApiException- if the remote call fails
-
listExampleStores
public final ExampleStoreServiceClient.ListExampleStoresPagedResponse listExampleStores(String parent) List ExampleStores in a Location.Sample code:
// This snippet has been automatically generated and should be regarded as a code template only. // It will require modifications to work: // - It may require correct/in-range values for request initialization. // - It may require specifying regional endpoints when creating the service client as shown in // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library try (ExampleStoreServiceClient exampleStoreServiceClient = ExampleStoreServiceClient.create()) { String parent = LocationName.of("[PROJECT]", "[LOCATION]").toString(); for (ExampleStore element : exampleStoreServiceClient.listExampleStores(parent).iterateAll()) { // doThingsWith(element); } }- Parameters:
parent- Required. The resource name of the Location to list the ExampleStores from. Format: `projects/{project}/locations/{location}`- Throws:
ApiException- if the remote call fails
-
listExampleStores
public final ExampleStoreServiceClient.ListExampleStoresPagedResponse listExampleStores(ListExampleStoresRequest request) List ExampleStores in a Location.Sample code:
// This snippet has been automatically generated and should be regarded as a code template only. // It will require modifications to work: // - It may require correct/in-range values for request initialization. // - It may require specifying regional endpoints when creating the service client as shown in // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library try (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); } }- Parameters:
request- The request object containing all of the parameters for the API call.- Throws:
ApiException- if the remote call fails
-
listExampleStoresPagedCallable
public final UnaryCallable<ListExampleStoresRequest,ExampleStoreServiceClient.ListExampleStoresPagedResponse> listExampleStoresPagedCallable()List ExampleStores in a Location.Sample code:
// This snippet has been automatically generated and should be regarded as a code template only. // It will require modifications to work: // - It may require correct/in-range values for request initialization. // - It may require specifying regional endpoints when creating the service client as shown in // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library try (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); } } -
listExampleStoresCallable
public final UnaryCallable<ListExampleStoresRequest,ListExampleStoresResponse> listExampleStoresCallable()List ExampleStores in a Location.Sample code:
// This snippet has been automatically generated and should be regarded as a code template only. // It will require modifications to work: // - It may require correct/in-range values for request initialization. // - It may require specifying regional endpoints when creating the service client as shown in // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library try (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; } } } -
upsertExamples
Create or update Examples in the Example Store.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); }- Parameters:
request- The request object containing all of the parameters for the API call.- Throws:
ApiException- if the remote call fails
-
upsertExamplesCallable
Create or update Examples in the Example Store.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(); } -
removeExamples
Remove Examples from the Example Store.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); }- Parameters:
request- The request object containing all of the parameters for the API call.- Throws:
ApiException- if the remote call fails
-
removeExamplesCallable
Remove Examples from the Example Store.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(); } -
searchExamples
Search for similar Examples for given selection criteria.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); }- Parameters:
request- The request object containing all of the parameters for the API call.- Throws:
ApiException- if the remote call fails
-
searchExamplesCallable
Search for similar Examples for given selection criteria.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(); } -
fetchExamples
public final ExampleStoreServiceClient.FetchExamplesPagedResponse fetchExamples(FetchExamplesRequest request) Get Examples from the Example Store.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); } }- Parameters:
request- The request object containing all of the parameters for the API call.- Throws:
ApiException- if the remote call fails
-
fetchExamplesPagedCallable
public final UnaryCallable<FetchExamplesRequest,ExampleStoreServiceClient.FetchExamplesPagedResponse> fetchExamplesPagedCallable()Get Examples from the Example Store.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); } } -
fetchExamplesCallable
Get Examples from the Example Store.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; } } } -
listLocations
public final ExampleStoreServiceClient.ListLocationsPagedResponse listLocations(ListLocationsRequest request) Lists information about the supported locations for this service.Sample code:
// This snippet has been automatically generated and should be regarded as a code template only. // It will require modifications to work: // - It may require correct/in-range values for request initialization. // - It may require specifying regional endpoints when creating the service client as shown in // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library try (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); } }- Parameters:
request- The request object containing all of the parameters for the API call.- Throws:
ApiException- if the remote call fails
-
listLocationsPagedCallable
public final UnaryCallable<ListLocationsRequest,ExampleStoreServiceClient.ListLocationsPagedResponse> listLocationsPagedCallable()Lists information about the supported locations for this service.Sample code:
// This snippet has been automatically generated and should be regarded as a code template only. // It will require modifications to work: // - It may require correct/in-range values for request initialization. // - It may require specifying regional endpoints when creating the service client as shown in // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library try (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); } } -
listLocationsCallable
Lists information about the supported locations for this service.Sample code:
// This snippet has been automatically generated and should be regarded as a code template only. // It will require modifications to work: // - It may require correct/in-range values for request initialization. // - It may require specifying regional endpoints when creating the service client as shown in // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library try (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; } } } -
getLocation
Gets information about a location.Sample code:
// This snippet has been automatically generated and should be regarded as a code template only. // It will require modifications to work: // - It may require correct/in-range values for request initialization. // - It may require specifying regional endpoints when creating the service client as shown in // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library try (ExampleStoreServiceClient exampleStoreServiceClient = ExampleStoreServiceClient.create()) { GetLocationRequest request = GetLocationRequest.newBuilder().setName("name3373707").build(); Location response = exampleStoreServiceClient.getLocation(request); }- Parameters:
request- The request object containing all of the parameters for the API call.- Throws:
ApiException- if the remote call fails
-
getLocationCallable
Gets information about a location.Sample code:
// This snippet has been automatically generated and should be regarded as a code template only. // It will require modifications to work: // - It may require correct/in-range values for request initialization. // - It may require specifying regional endpoints when creating the service client as shown in // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library try (ExampleStoreServiceClient exampleStoreServiceClient = ExampleStoreServiceClient.create()) { GetLocationRequest request = GetLocationRequest.newBuilder().setName("name3373707").build(); ApiFuture<Location> future = exampleStoreServiceClient.getLocationCallable().futureCall(request); // Do something. Location response = future.get(); } -
setIamPolicy
Sets the access control policy on the specified resource. Replacesany existing policy.Can return `NOT_FOUND`, `INVALID_ARGUMENT`, and `PERMISSION_DENIED`errors.
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only. // It will require modifications to work: // - It may require correct/in-range values for request initialization. // - It may require specifying regional endpoints when creating the service client as shown in // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library try (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); }- Parameters:
request- The request object containing all of the parameters for the API call.- Throws:
ApiException- if the remote call fails
-
setIamPolicyCallable
Sets the access control policy on the specified resource. Replacesany existing policy.Can return `NOT_FOUND`, `INVALID_ARGUMENT`, and `PERMISSION_DENIED`errors.
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only. // It will require modifications to work: // - It may require correct/in-range values for request initialization. // - It may require specifying regional endpoints when creating the service client as shown in // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library try (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(); } -
getIamPolicy
Gets the access control policy for a resource. Returns an empty policyif the resource exists and does not have a policy set.Sample code:
// This snippet has been automatically generated and should be regarded as a code template only. // It will require modifications to work: // - It may require correct/in-range values for request initialization. // - It may require specifying regional endpoints when creating the service client as shown in // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library try (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); }- Parameters:
request- The request object containing all of the parameters for the API call.- Throws:
ApiException- if the remote call fails
-
getIamPolicyCallable
Gets the access control policy for a resource. Returns an empty policyif the resource exists and does not have a policy set.Sample code:
// This snippet has been automatically generated and should be regarded as a code template only. // It will require modifications to work: // - It may require correct/in-range values for request initialization. // - It may require specifying regional endpoints when creating the service client as shown in // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library try (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(); } -
testIamPermissions
Returns permissions that a caller has on the specified resource. If theresource does not exist, this will return an empty set ofpermissions, not a `NOT_FOUND` error.Note: This operation is designed to be used for buildingpermission-aware UIs and command-line tools, not for authorizationchecking. This operation may "fail open" without warning.
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only. // It will require modifications to work: // - It may require correct/in-range values for request initialization. // - It may require specifying regional endpoints when creating the service client as shown in // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library try (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); }- Parameters:
request- The request object containing all of the parameters for the API call.- Throws:
ApiException- if the remote call fails
-
testIamPermissionsCallable
public final UnaryCallable<TestIamPermissionsRequest,TestIamPermissionsResponse> testIamPermissionsCallable()Returns permissions that a caller has on the specified resource. If theresource does not exist, this will return an empty set ofpermissions, not a `NOT_FOUND` error.Note: This operation is designed to be used for buildingpermission-aware UIs and command-line tools, not for authorizationchecking. This operation may "fail open" without warning.
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only. // It will require modifications to work: // - It may require correct/in-range values for request initialization. // - It may require specifying regional endpoints when creating the service client as shown in // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library try (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(); } -
close
public final void close()- Specified by:
closein interfaceAutoCloseable
-
shutdown
public void shutdown()- Specified by:
shutdownin interfaceBackgroundResource
-
isShutdown
public boolean isShutdown()- Specified by:
isShutdownin interfaceBackgroundResource
-
isTerminated
public boolean isTerminated()- Specified by:
isTerminatedin interfaceBackgroundResource
-
shutdownNow
public void shutdownNow()- Specified by:
shutdownNowin interfaceBackgroundResource
-
awaitTermination
- Specified by:
awaitTerminationin interfaceBackgroundResource- Throws:
InterruptedException
-