Class ExampleStoreServiceClient

java.lang.Object
com.google.cloud.aiplatform.v1beta1.ExampleStoreServiceClient
All Implemented Interfaces:
BackgroundResource, AutoCloseable

@BetaApi @Generated("by gapic-generator-java") public class ExampleStoreServiceClient extends Object implements BackgroundResource
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_DENIED`errors.

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.

  • Constructor Details

    • ExampleStoreServiceClient

      protected ExampleStoreServiceClient(ExampleStoreServiceSettings settings) throws IOException
      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

      protected ExampleStoreServiceClient(ExampleStoreServiceStub stub)
  • Method Details

    • create

      public static final ExampleStoreServiceClient create() throws IOException
      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

      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).
    • getSettings

      public final ExampleStoreServiceSettings getSettings()
    • getStub

      public ExampleStoreServiceStub getStub()
    • 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.
    • 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

      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

      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

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

      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);
       }
       
      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

      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);
       }
       
      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

      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);
       }
       
      Parameters:
      request - The request object containing all of the parameters for the API call.
      Throws:
      ApiException - if the remote call fails
    • getExampleStoreCallable

      public final UnaryCallable<GetExampleStoreRequest,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<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

      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

      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

      public final UnaryCallable<UpdateExampleStoreRequest,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<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,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<Empty, DeleteExampleStoreOperationMetadata> future =
             exampleStoreServiceClient.deleteExampleStoreOperationCallable().futureCall(request);
         // Do something.
         future.get();
       }
       
    • deleteExampleStoreCallable

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

      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

      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

      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

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

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

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

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

      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);
       }
       
      Parameters:
      request - The request object containing all of the parameters for the API call.
      Throws:
      ApiException - if the remote call fails
    • searchExamplesCallable

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

      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

      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

      public final UnaryCallable<FetchExamplesRequest,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<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

      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

      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

      public final UnaryCallable<ListLocationsRequest,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;
           }
         }
       }
       
    • getLocation

      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);
       }
       
      Parameters:
      request - The request object containing all of the parameters for the API call.
      Throws:
      ApiException - if the remote call fails
    • getLocationCallable

      public final UnaryCallable<GetLocationRequest,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<Location> future =
             exampleStoreServiceClient.getLocationCallable().futureCall(request);
         // Do something.
         Location response = future.get();
       }
       
    • setIamPolicy

      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_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

      public final UnaryCallable<SetIamPolicyRequest,Policy> 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

      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);
       }
       
      Parameters:
      request - The request object containing all of the parameters for the API call.
      Throws:
      ApiException - if the remote call fails
    • getIamPolicyCallable

      public final UnaryCallable<GetIamPolicyRequest,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<Policy> future =
             exampleStoreServiceClient.getIamPolicyCallable().futureCall(request);
         // Do something.
         Policy response = future.get();
       }
       
    • testIamPermissions

      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<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:
      close in interface AutoCloseable
    • shutdown

      public void shutdown()
      Specified by:
      shutdown in interface BackgroundResource
    • isShutdown

      public boolean isShutdown()
      Specified by:
      isShutdown in interface BackgroundResource
    • isTerminated

      public boolean isTerminated()
      Specified by:
      isTerminated in interface BackgroundResource
    • shutdownNow

      public void shutdownNow()
      Specified by:
      shutdownNow in interface BackgroundResource
    • awaitTermination

      public boolean awaitTermination(long duration, TimeUnit unit) throws InterruptedException
      Specified by:
      awaitTermination in interface BackgroundResource
      Throws:
      InterruptedException