Class ExampleStoreServiceClient (3.64.0)

GitHub RepositoryProduct ReferenceREST DocumentationRPC Documentation

Service Description: A service for managing and retrieving few-shot examples.

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().

Methods
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.

  • createExampleStoreAsync(CreateExampleStoreRequest request)

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

  • createExampleStoreAsync(LocationName parent, ExampleStore exampleStore)

  • createExampleStoreAsync(String parent, ExampleStore exampleStore)

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

  • createExampleStoreOperationCallable()

  • createExampleStoreCallable()

GetExampleStore

Get an ExampleStore.

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

  • getExampleStore(GetExampleStoreRequest request)

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

  • getExampleStore(ExampleStoreName name)

  • getExampleStore(String name)

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

  • getExampleStoreCallable()

UpdateExampleStore

Update an ExampleStore.

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

  • updateExampleStoreAsync(UpdateExampleStoreRequest request)

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

  • updateExampleStoreAsync(ExampleStore exampleStore, FieldMask updateMask)

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

  • updateExampleStoreOperationCallable()

  • updateExampleStoreCallable()

DeleteExampleStore

Delete an ExampleStore.

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

  • deleteExampleStoreAsync(DeleteExampleStoreRequest request)

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

  • deleteExampleStoreAsync(ExampleStoreName name)

  • deleteExampleStoreAsync(String name)

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

  • deleteExampleStoreOperationCallable()

  • deleteExampleStoreCallable()

ListExampleStores

List ExampleStores in a Location.

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

  • listExampleStores(ListExampleStoresRequest request)

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

  • listExampleStores(LocationName parent)

  • listExampleStores(String parent)

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

  • listExampleStoresPagedCallable()

  • listExampleStoresCallable()

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.

  • upsertExamples(UpsertExamplesRequest request)

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

  • upsertExamplesCallable()

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.

  • removeExamples(RemoveExamplesRequest request)

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

  • removeExamplesCallable()

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.

  • searchExamples(SearchExamplesRequest request)

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

  • searchExamplesCallable()

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.

  • fetchExamples(FetchExamplesRequest request)

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

  • fetchExamplesPagedCallable()

  • fetchExamplesCallable()

ListLocations

Lists information about the supported locations for this service.

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

  • listLocations(ListLocationsRequest request)

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

  • listLocationsPagedCallable()

  • listLocationsCallable()

GetLocation

Gets information about a location.

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

  • getLocation(GetLocationRequest request)

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

  • getLocationCallable()

SetIamPolicy

Sets the access control policy on the specified resource. Replacesany existing policy.

Can return NOT_FOUND, INVALID_ARGUMENT, and PERMISSION_DENIEDerrors.

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

  • setIamPolicy(SetIamPolicyRequest request)

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

  • setIamPolicyCallable()

GetIamPolicy

Gets the access control policy for a resource. Returns an empty policyif the resource exists and does not have a policy set.

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

  • getIamPolicy(GetIamPolicyRequest request)

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

  • getIamPolicyCallable()

TestIamPermissions

Returns permissions that a caller has on the specified resource. If theresource does not exist, this will return an empty set ofpermissions, not a NOT_FOUND error.

Note: This operation is designed to be used for buildingpermission-aware UIs and command-line tools, not for authorizationchecking. This operation may "fail open" without warning.

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

  • testIamPermissions(TestIamPermissionsRequest request)

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

  • testIamPermissionsCallable()

See the individual methods for example code.

Many parameters require resource names to be formatted in a particular way. To assist with these names, this class includes a format method for each type of name, and additionally a parse method to extract the individual identifiers contained within names that are returned.

This class can be customized by passing in a custom instance of 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.

Inheritance

java.lang.Object > ExampleStoreServiceClient

Static Methods

create()

public static final ExampleStoreServiceClient create()

Constructs an instance of ExampleStoreServiceClient with default settings.

Returns
Type Description
ExampleStoreServiceClient
Exceptions
Type Description
IOException

create(ExampleStoreServiceSettings settings)

public static final ExampleStoreServiceClient create(ExampleStoreServiceSettings settings)

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.

Parameter
Name Description
settings ExampleStoreServiceSettings
Returns
Type Description
ExampleStoreServiceClient
Exceptions
Type Description
IOException

create(ExampleStoreServiceStub stub)

public static final ExampleStoreServiceClient create(ExampleStoreServiceStub stub)

Constructs an instance of ExampleStoreServiceClient, using the given stub for making calls. This is for advanced usage - prefer using create(ExampleStoreServiceSettings).

Parameter
Name Description
stub ExampleStoreServiceStub
Returns
Type Description
ExampleStoreServiceClient

Constructors

ExampleStoreServiceClient(ExampleStoreServiceSettings settings)

protected ExampleStoreServiceClient(ExampleStoreServiceSettings settings)

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.

Parameter
Name Description
settings ExampleStoreServiceSettings

ExampleStoreServiceClient(ExampleStoreServiceStub stub)

protected ExampleStoreServiceClient(ExampleStoreServiceStub stub)
Parameter
Name Description
stub ExampleStoreServiceStub

Methods

awaitTermination(long duration, TimeUnit unit)

public boolean awaitTermination(long duration, TimeUnit unit)
Parameters
Name Description
duration long
unit TimeUnit
Returns
Type Description
boolean
Exceptions
Type Description
InterruptedException

close()

public final void close()

createExampleStoreAsync(CreateExampleStoreRequest request)

public final OperationFuture,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();
 }
 
Parameter
Name Description
request CreateExampleStoreRequest

The request object containing all of the parameters for the API call.

Returns
Type Description
OperationFuture<ExampleStore,CreateExampleStoreOperationMetadata>

createExampleStoreAsync(LocationName parent, ExampleStore exampleStore)

public final OperationFuture,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
Name Description
parent LocationName

Required. The resource name of the Location to create the ExampleStore in. Format: projects/{project}/locations/{location}

exampleStore ExampleStore

Required. The Example Store to be created.

Returns
Type Description
OperationFuture<ExampleStore,CreateExampleStoreOperationMetadata>

createExampleStoreAsync(String parent, ExampleStore exampleStore)

public final OperationFuture,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
Name Description
parent String

Required. The resource name of the Location to create the ExampleStore in. Format: projects/{project}/locations/{location}

exampleStore ExampleStore

Required. The Example Store to be created.

Returns
Type Description
OperationFuture<ExampleStore,CreateExampleStoreOperationMetadata>

createExampleStoreCallable()

public final UnaryCallable,Operation> 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 future =
       exampleStoreServiceClient.createExampleStoreCallable().futureCall(request);
   // Do something.
   Operation response = future.get();
 }
 
Returns
Type Description
UnaryCallable<CreateExampleStoreRequest,Operation>

createExampleStoreOperationCallable()

public final OperationCallable,ExampleStore,CreateExampleStoreOperationMetadata> createExampleStoreOperationCallable()

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, CreateExampleStoreOperationMetadata> future =
       exampleStoreServiceClient.createExampleStoreOperationCallable().futureCall(request);
   // Do something.
   ExampleStore response = future.get();
 }
 
Returns
Type Description
OperationCallable<CreateExampleStoreRequest,ExampleStore,CreateExampleStoreOperationMetadata>

deleteExampleStoreAsync(DeleteExampleStoreRequest request)

public final OperationFuture,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();
 }
 
Parameter
Name Description
request DeleteExampleStoreRequest

The request object containing all of the parameters for the API call.

Returns
Type Description
OperationFuture<Empty,DeleteExampleStoreOperationMetadata>

deleteExampleStoreAsync(ExampleStoreName name)

public final OperationFuture,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();
 }
 
Parameter
Name Description
name ExampleStoreName

Required. The resource name of the ExampleStore to be deleted. Format: projects/{project}/locations/{location}/exampleStores/{example_store}

Returns
Type Description
OperationFuture<Empty,DeleteExampleStoreOperationMetadata>

deleteExampleStoreAsync(String name)

public final OperationFuture,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();
 }
 
Parameter
Name Description
name String

Required. The resource name of the ExampleStore to be deleted. Format: projects/{project}/locations/{location}/exampleStores/{example_store}

Returns
Type Description
OperationFuture<Empty,DeleteExampleStoreOperationMetadata>

deleteExampleStoreCallable()

public final UnaryCallable,Operation> 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 future =
       exampleStoreServiceClient.deleteExampleStoreCallable().futureCall(request);
   // Do something.
   future.get();
 }
 
Returns
Type Description
UnaryCallable<DeleteExampleStoreRequest,Operation>

deleteExampleStoreOperationCallable()

public final OperationCallable,Empty,DeleteExampleStoreOperationMetadata> deleteExampleStoreOperationCallable()

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, DeleteExampleStoreOperationMetadata> future =
       exampleStoreServiceClient.deleteExampleStoreOperationCallable().futureCall(request);
   // Do something.
   future.get();
 }
 
Returns
Type Description
OperationCallable<DeleteExampleStoreRequest,Empty,DeleteExampleStoreOperationMetadata>

fetchExamples(FetchExamplesRequest request)

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())
           .build();
   for (Example element : exampleStoreServiceClient.fetchExamples(request).iterateAll()) {
     // doThingsWith(element);
   }
 }
 
Parameter
Name Description
request FetchExamplesRequest

The request object containing all of the parameters for the API call.

Returns
Type Description
ExampleStoreServiceClient.FetchExamplesPagedResponse

fetchExamplesCallable()

public final UnaryCallable,FetchExamplesResponse> 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())
           .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;
     }
   }
 }
 
Returns
Type Description
UnaryCallable<FetchExamplesRequest,FetchExamplesResponse>

fetchExamplesPagedCallable()

public final UnaryCallable,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())
           .build();
   ApiFuture future =
       exampleStoreServiceClient.fetchExamplesPagedCallable().futureCall(request);
   // Do something.
   for (Example element : future.get().iterateAll()) {
     // doThingsWith(element);
   }
 }
 
Returns
Type Description
UnaryCallable<FetchExamplesRequest,FetchExamplesPagedResponse>

getExampleStore(ExampleStoreName name)

public final ExampleStore getExampleStore(ExampleStoreName name)

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);
 }
 
Parameter
Name Description
name ExampleStoreName

Required. The resource name of the ExampleStore. Format: projects/{project}/locations/{location}/exampleStores/{example_store}

Returns
Type Description
ExampleStore

getExampleStore(GetExampleStoreRequest request)

public final ExampleStore getExampleStore(GetExampleStoreRequest request)

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);
 }
 
Parameter
Name Description
request GetExampleStoreRequest

The request object containing all of the parameters for the API call.

Returns
Type Description
ExampleStore

getExampleStore(String name)

public final ExampleStore getExampleStore(String name)

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);
 }
 
Parameter
Name Description
name String

Required. The resource name of the ExampleStore. Format: projects/{project}/locations/{location}/exampleStores/{example_store}

Returns
Type Description
ExampleStore

getExampleStoreCallable()

public final UnaryCallable,ExampleStore> 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 future =
       exampleStoreServiceClient.getExampleStoreCallable().futureCall(request);
   // Do something.
   ExampleStore response = future.get();
 }
 
Returns
Type Description
UnaryCallable<GetExampleStoreRequest,ExampleStore>

getIamPolicy(GetIamPolicyRequest request)

public final Policy getIamPolicy(GetIamPolicyRequest request)

Gets the access control policy for a resource. Returns an empty policyif the resource exists and does not have a policy set.

Sample code:


 // This snippet has been automatically generated and should be regarded as a code template only.
 // It will require modifications to work:
 // - It may require correct/in-range values for request initialization.
 // - It may require specifying regional endpoints when creating the service client as shown in
 // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
 try (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);
 }
 
Parameter
Name Description
request com.google.iam.v1.GetIamPolicyRequest

The request object containing all of the parameters for the API call.

Returns
Type Description
com.google.iam.v1.Policy

getIamPolicyCallable()

public final UnaryCallable,Policy> getIamPolicyCallable()

Gets the access control policy for a resource. Returns an empty policyif the resource exists and does not have a policy set.

Sample code:


 // This snippet has been automatically generated and should be regarded as a code template only.
 // It will require modifications to work:
 // - It may require correct/in-range values for request initialization.
 // - It may require specifying regional endpoints when creating the service client as shown in
 // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
 try (ExampleStoreServiceClient exampleStoreServiceClient = ExampleStoreServiceClient.create()) {
   GetIamPolicyRequest request =
       GetIamPolicyRequest.newBuilder()
           .setResource(
               EndpointName.ofProjectLocationEndpointName(
                       "[PROJECT]", "[LOCATION]", "[ENDPOINT]")
                   .toString())
           .setOptions(GetPolicyOptions.newBuilder().build())
           .build();
   ApiFuture future =
       exampleStoreServiceClient.getIamPolicyCallable().futureCall(request);
   // Do something.
   Policy response = future.get();
 }
 
Returns
Type Description
UnaryCallable<com.google.iam.v1.GetIamPolicyRequest,com.google.iam.v1.Policy>

getLocation(GetLocationRequest request)

public final Location getLocation(GetLocationRequest request)

Gets information about a location.

Sample code:


 // This snippet has been automatically generated and should be regarded as a code template only.
 // It will require modifications to work:
 // - It may require correct/in-range values for request initialization.
 // - It may require specifying regional endpoints when creating the service client as shown in
 // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
 try (ExampleStoreServiceClient exampleStoreServiceClient = ExampleStoreServiceClient.create()) {
   GetLocationRequest request = GetLocationRequest.newBuilder().setName("name3373707").build();
   Location response = exampleStoreServiceClient.getLocation(request);
 }
 
Parameter
Name Description
request com.google.cloud.location.GetLocationRequest

The request object containing all of the parameters for the API call.

Returns
Type Description
com.google.cloud.location.Location

getLocationCallable()

public final UnaryCallable,Location> getLocationCallable()

Gets information about a location.

Sample code:


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

getOperationsClient()

public final OperationsClient getOperationsClient()

Returns the OperationsClient that can be used to query the status of a long-running operation returned by another API method call.

Returns
Type Description
OperationsClient

getSettings()

public final ExampleStoreServiceSettings getSettings()
Returns
Type Description
ExampleStoreServiceSettings

getStub()

public ExampleStoreServiceStub getStub()
Returns
Type Description
ExampleStoreServiceStub

isShutdown()

public boolean isShutdown()
Returns
Type Description
boolean

isTerminated()

public boolean isTerminated()
Returns
Type Description
boolean

listExampleStores(ListExampleStoresRequest request)

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);
   }
 }
 
Parameter
Name Description
request ListExampleStoresRequest

The request object containing all of the parameters for the API call.

Returns
Type Description
ExampleStoreServiceClient.ListExampleStoresPagedResponse

listExampleStores(LocationName parent)

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);
   }
 }
 
Parameter
Name Description
parent LocationName

Required. The resource name of the Location to list the ExampleStores from. Format: projects/{project}/locations/{location}

Returns
Type Description
ExampleStoreServiceClient.ListExampleStoresPagedResponse

listExampleStores(String parent)

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);
   }
 }
 
Parameter
Name Description
parent String

Required. The resource name of the Location to list the ExampleStores from. Format: projects/{project}/locations/{location}

Returns
Type Description
ExampleStoreServiceClient.ListExampleStoresPagedResponse

listExampleStoresCallable()

public final UnaryCallable,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;
     }
   }
 }
 
Returns
Type Description
UnaryCallable<ListExampleStoresRequest,ListExampleStoresResponse>

listExampleStoresPagedCallable()

public final UnaryCallable,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 future =
       exampleStoreServiceClient.listExampleStoresPagedCallable().futureCall(request);
   // Do something.
   for (ExampleStore element : future.get().iterateAll()) {
     // doThingsWith(element);
   }
 }
 
Returns
Type Description
UnaryCallable<ListExampleStoresRequest,ListExampleStoresPagedResponse>

listLocations(ListLocationsRequest request)

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);
   }
 }
 
Parameter
Name Description
request com.google.cloud.location.ListLocationsRequest

The request object containing all of the parameters for the API call.

Returns
Type Description
ExampleStoreServiceClient.ListLocationsPagedResponse

listLocationsCallable()

public final UnaryCallable,ListLocationsResponse> listLocationsCallable()

Lists information about the supported locations for this service.

Sample code:


 // This snippet has been automatically generated and should be regarded as a code template only.
 // It will require modifications to work:
 // - It may require correct/in-range values for request initialization.
 // - It may require specifying regional endpoints when creating the service client as shown in
 // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
 try (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;
     }
   }
 }
 
Returns
Type Description
UnaryCallable<com.google.cloud.location.ListLocationsRequest,com.google.cloud.location.ListLocationsResponse>

listLocationsPagedCallable()

public final UnaryCallable,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 future =
       exampleStoreServiceClient.listLocationsPagedCallable().futureCall(request);
   // Do something.
   for (Location element : future.get().iterateAll()) {
     // doThingsWith(element);
   }
 }
 
Returns
Type Description
UnaryCallable<com.google.cloud.location.ListLocationsRequest,ListLocationsPagedResponse>

removeExamples(RemoveExamplesRequest request)

public final RemoveExamplesResponse removeExamples(RemoveExamplesRequest request)

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())
           .build();
   RemoveExamplesResponse response = exampleStoreServiceClient.removeExamples(request);
 }
 
Parameter
Name Description
request RemoveExamplesRequest

The request object containing all of the parameters for the API call.

Returns
Type Description
RemoveExamplesResponse

removeExamplesCallable()

public final UnaryCallable,RemoveExamplesResponse> 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())
           .build();
   ApiFuture future =
       exampleStoreServiceClient.removeExamplesCallable().futureCall(request);
   // Do something.
   RemoveExamplesResponse response = future.get();
 }
 
Returns
Type Description
UnaryCallable<RemoveExamplesRequest,RemoveExamplesResponse>

searchExamples(SearchExamplesRequest request)

public final SearchExamplesResponse searchExamples(SearchExamplesRequest request)

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);
 }
 
Parameter
Name Description
request SearchExamplesRequest

The request object containing all of the parameters for the API call.

Returns
Type Description
SearchExamplesResponse

searchExamplesCallable()

public final UnaryCallable,SearchExamplesResponse> 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 future =
       exampleStoreServiceClient.searchExamplesCallable().futureCall(request);
   // Do something.
   SearchExamplesResponse response = future.get();
 }
 
Returns
Type Description
UnaryCallable<SearchExamplesRequest,SearchExamplesResponse>

setIamPolicy(SetIamPolicyRequest request)

public final Policy setIamPolicy(SetIamPolicyRequest request)

Sets the access control policy on the specified resource. Replacesany existing policy.

Can return NOT_FOUND, INVALID_ARGUMENT, and PERMISSION_DENIEDerrors.

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);
 }
 
Parameter
Name Description
request com.google.iam.v1.SetIamPolicyRequest

The request object containing all of the parameters for the API call.

Returns
Type Description
com.google.iam.v1.Policy

setIamPolicyCallable()

public final UnaryCallable,Policy> setIamPolicyCallable()

Sets the access control policy on the specified resource. Replacesany existing policy.

Can return NOT_FOUND, INVALID_ARGUMENT, and PERMISSION_DENIEDerrors.

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 future =
       exampleStoreServiceClient.setIamPolicyCallable().futureCall(request);
   // Do something.
   Policy response = future.get();
 }
 
Returns
Type Description
UnaryCallable<com.google.iam.v1.SetIamPolicyRequest,com.google.iam.v1.Policy>

shutdown()

public void shutdown()

shutdownNow()

public void shutdownNow()

testIamPermissions(TestIamPermissionsRequest request)

public final TestIamPermissionsResponse testIamPermissions(TestIamPermissionsRequest request)

Returns permissions that a caller has on the specified resource. If theresource does not exist, this will return an empty set ofpermissions, not a NOT_FOUND error.

Note: This operation is designed to be used for buildingpermission-aware UIs and command-line tools, not for authorizationchecking. This operation may "fail open" without warning.

Sample code:


 // This snippet has been automatically generated and should be regarded as a code template only.
 // It will require modifications to work:
 // - It may require correct/in-range values for request initialization.
 // - It may require specifying regional endpoints when creating the service client as shown in
 // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
 try (ExampleStoreServiceClient exampleStoreServiceClient = ExampleStoreServiceClient.create()) {
   TestIamPermissionsRequest request =
       TestIamPermissionsRequest.newBuilder()
           .setResource(
               EndpointName.ofProjectLocationEndpointName(
                       "[PROJECT]", "[LOCATION]", "[ENDPOINT]")
                   .toString())
           .addAllPermissions(new ArrayList())
           .build();
   TestIamPermissionsResponse response = exampleStoreServiceClient.testIamPermissions(request);
 }
 
Parameter
Name Description
request com.google.iam.v1.TestIamPermissionsRequest

The request object containing all of the parameters for the API call.

Returns
Type Description
com.google.iam.v1.TestIamPermissionsResponse

testIamPermissionsCallable()

public final UnaryCallable,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())
           .build();
   ApiFuture future =
       exampleStoreServiceClient.testIamPermissionsCallable().futureCall(request);
   // Do something.
   TestIamPermissionsResponse response = future.get();
 }
 
Returns
Type Description
UnaryCallable<com.google.iam.v1.TestIamPermissionsRequest,com.google.iam.v1.TestIamPermissionsResponse>

updateExampleStoreAsync(ExampleStore exampleStore, FieldMask updateMask)

public final OperationFuture,UpdateExampleStoreOperationMetadata> updateExampleStoreAsync(ExampleStore exampleStore, 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
Name Description
exampleStore ExampleStore

Required. The Example Store which replaces the resource on the server.

updateMask FieldMask

Optional. Mask specifying which fields to update. Supported fields:

* display_name * description

Returns
Type Description
OperationFuture<ExampleStore,UpdateExampleStoreOperationMetadata>

updateExampleStoreAsync(UpdateExampleStoreRequest request)

public final OperationFuture,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();
 }
 
Parameter
Name Description
request UpdateExampleStoreRequest

The request object containing all of the parameters for the API call.

Returns
Type Description
OperationFuture<ExampleStore,UpdateExampleStoreOperationMetadata>

updateExampleStoreCallable()

public final UnaryCallable,Operation> 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 future =
       exampleStoreServiceClient.updateExampleStoreCallable().futureCall(request);
   // Do something.
   Operation response = future.get();
 }
 
Returns
Type Description
UnaryCallable<UpdateExampleStoreRequest,Operation>

updateExampleStoreOperationCallable()

public final OperationCallable,ExampleStore,UpdateExampleStoreOperationMetadata> updateExampleStoreOperationCallable()

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, UpdateExampleStoreOperationMetadata> future =
       exampleStoreServiceClient.updateExampleStoreOperationCallable().futureCall(request);
   // Do something.
   ExampleStore response = future.get();
 }
 
Returns
Type Description
OperationCallable<UpdateExampleStoreRequest,ExampleStore,UpdateExampleStoreOperationMetadata>

upsertExamples(UpsertExamplesRequest request)

public final UpsertExamplesResponse upsertExamples(UpsertExamplesRequest request)

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())
           .setOverwrite(true)
           .build();
   UpsertExamplesResponse response = exampleStoreServiceClient.upsertExamples(request);
 }
 
Parameter
Name Description
request UpsertExamplesRequest

The request object containing all of the parameters for the API call.

Returns
Type Description
UpsertExamplesResponse

upsertExamplesCallable()

public final UnaryCallable,UpsertExamplesResponse> 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())
           .setOverwrite(true)
           .build();
   ApiFuture future =
       exampleStoreServiceClient.upsertExamplesCallable().futureCall(request);
   // Do something.
   UpsertExamplesResponse response = future.get();
 }
 
Returns
Type Description
UnaryCallable<UpsertExamplesRequest,UpsertExamplesResponse>