Class IndexServiceClient

  • All Implemented Interfaces:
    com.google.api.gax.core.BackgroundResource, AutoCloseable

    @Generated("by gapic-generator-java")
    public class IndexServiceClient
    extends Object
    implements com.google.api.gax.core.BackgroundResource
    Service Description: A service for creating and managing Vertex AI's Index resources.

    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 (IndexServiceClient indexServiceClient = IndexServiceClient.create()) {
       IndexName name = IndexName.of("[PROJECT]", "[LOCATION]", "[INDEX]");
       Index response = indexServiceClient.getIndex(name);
     }
     

    Note: close() needs to be called on the IndexServiceClient object to clean up resources such as threads. In the example above, try-with-resources is used, which automatically calls close().

    The surface of this class includes several types of Java methods for each of the API's methods:

    1. A "flattened" method. With this type of method, the fields of the request type have been converted into function parameters. It may be the case that not all fields are available as parameters, and not every API method will have a flattened method entry point.
    2. A "request object" method. This type of method only takes one parameter, a request object, which must be constructed before the call. Not every API method will have a request object method.
    3. A "callable" method. This type of method takes no parameters and returns an immutable API callable object, which can be used to initiate calls to the service.

    See the individual methods for example code.

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

    This class can be customized by passing in a custom instance of IndexServiceSettings 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
     IndexServiceSettings indexServiceSettings =
         IndexServiceSettings.newBuilder()
             .setCredentialsProvider(FixedCredentialsProvider.create(myCredentials))
             .build();
     IndexServiceClient indexServiceClient = IndexServiceClient.create(indexServiceSettings);
     

    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
     IndexServiceSettings indexServiceSettings =
         IndexServiceSettings.newBuilder().setEndpoint(myEndpoint).build();
     IndexServiceClient indexServiceClient = IndexServiceClient.create(indexServiceSettings);
     

    Please refer to the GitHub repository's samples for more quickstart code snippets.

    • Constructor Detail

      • IndexServiceClient

        protected IndexServiceClient​(IndexServiceSettings settings)
                              throws IOException
        Constructs an instance of IndexServiceClient, 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
    • Method Detail

      • create

        public static final IndexServiceClient create​(IndexServiceSettings settings)
                                               throws IOException
        Constructs an instance of IndexServiceClient, 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 IndexServiceClient create​(IndexServiceStub stub)
        Constructs an instance of IndexServiceClient, using the given stub for making calls. This is for advanced usage - prefer using create(IndexServiceSettings).
      • getOperationsClient

        public final com.google.longrunning.OperationsClient getOperationsClient()
        Returns the OperationsClient that can be used to query the status of a long-running operation returned by another API method call.
      • createIndexAsync

        public final com.google.api.gax.longrunning.OperationFuture<Index,​CreateIndexOperationMetadata> createIndexAsync​(LocationName parent,
                                                                                                                               Index index)
        Creates an Index.

        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 (IndexServiceClient indexServiceClient = IndexServiceClient.create()) {
           LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]");
           Index index = Index.newBuilder().build();
           Index response = indexServiceClient.createIndexAsync(parent, index).get();
         }
         
        Parameters:
        parent - Required. The resource name of the Location to create the Index in. Format: `projects/{project}/locations/{location}`
        index - Required. The Index to create.
        Throws:
        com.google.api.gax.rpc.ApiException - if the remote call fails
      • createIndexAsync

        public final com.google.api.gax.longrunning.OperationFuture<Index,​CreateIndexOperationMetadata> createIndexAsync​(String parent,
                                                                                                                               Index index)
        Creates an Index.

        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 (IndexServiceClient indexServiceClient = IndexServiceClient.create()) {
           String parent = LocationName.of("[PROJECT]", "[LOCATION]").toString();
           Index index = Index.newBuilder().build();
           Index response = indexServiceClient.createIndexAsync(parent, index).get();
         }
         
        Parameters:
        parent - Required. The resource name of the Location to create the Index in. Format: `projects/{project}/locations/{location}`
        index - Required. The Index to create.
        Throws:
        com.google.api.gax.rpc.ApiException - if the remote call fails
      • createIndexAsync

        public final com.google.api.gax.longrunning.OperationFuture<Index,​CreateIndexOperationMetadata> createIndexAsync​(CreateIndexRequest request)
        Creates an Index.

        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 (IndexServiceClient indexServiceClient = IndexServiceClient.create()) {
           CreateIndexRequest request =
               CreateIndexRequest.newBuilder()
                   .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString())
                   .setIndex(Index.newBuilder().build())
                   .build();
           Index response = indexServiceClient.createIndexAsync(request).get();
         }
         
        Parameters:
        request - The request object containing all of the parameters for the API call.
        Throws:
        com.google.api.gax.rpc.ApiException - if the remote call fails
      • createIndexOperationCallable

        public final com.google.api.gax.rpc.OperationCallable<CreateIndexRequest,​Index,​CreateIndexOperationMetadata> createIndexOperationCallable()
        Creates an Index.

        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 (IndexServiceClient indexServiceClient = IndexServiceClient.create()) {
           CreateIndexRequest request =
               CreateIndexRequest.newBuilder()
                   .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString())
                   .setIndex(Index.newBuilder().build())
                   .build();
           OperationFuture<Index, CreateIndexOperationMetadata> future =
               indexServiceClient.createIndexOperationCallable().futureCall(request);
           // Do something.
           Index response = future.get();
         }
         
      • createIndexCallable

        public final com.google.api.gax.rpc.UnaryCallable<CreateIndexRequest,​com.google.longrunning.Operation> createIndexCallable()
        Creates an Index.

        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 (IndexServiceClient indexServiceClient = IndexServiceClient.create()) {
           CreateIndexRequest request =
               CreateIndexRequest.newBuilder()
                   .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString())
                   .setIndex(Index.newBuilder().build())
                   .build();
           ApiFuture<Operation> future = indexServiceClient.createIndexCallable().futureCall(request);
           // Do something.
           Operation response = future.get();
         }
         
      • getIndex

        public final Index getIndex​(IndexName name)
        Gets an Index.

        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 (IndexServiceClient indexServiceClient = IndexServiceClient.create()) {
           IndexName name = IndexName.of("[PROJECT]", "[LOCATION]", "[INDEX]");
           Index response = indexServiceClient.getIndex(name);
         }
         
        Parameters:
        name - Required. The name of the Index resource. Format: `projects/{project}/locations/{location}/indexes/{index}`
        Throws:
        com.google.api.gax.rpc.ApiException - if the remote call fails
      • getIndex

        public final Index getIndex​(String name)
        Gets an Index.

        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 (IndexServiceClient indexServiceClient = IndexServiceClient.create()) {
           String name = IndexName.of("[PROJECT]", "[LOCATION]", "[INDEX]").toString();
           Index response = indexServiceClient.getIndex(name);
         }
         
        Parameters:
        name - Required. The name of the Index resource. Format: `projects/{project}/locations/{location}/indexes/{index}`
        Throws:
        com.google.api.gax.rpc.ApiException - if the remote call fails
      • getIndex

        public final Index getIndex​(GetIndexRequest request)
        Gets an Index.

        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 (IndexServiceClient indexServiceClient = IndexServiceClient.create()) {
           GetIndexRequest request =
               GetIndexRequest.newBuilder()
                   .setName(IndexName.of("[PROJECT]", "[LOCATION]", "[INDEX]").toString())
                   .build();
           Index response = indexServiceClient.getIndex(request);
         }
         
        Parameters:
        request - The request object containing all of the parameters for the API call.
        Throws:
        com.google.api.gax.rpc.ApiException - if the remote call fails
      • getIndexCallable

        public final com.google.api.gax.rpc.UnaryCallable<GetIndexRequest,​Index> getIndexCallable()
        Gets an Index.

        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 (IndexServiceClient indexServiceClient = IndexServiceClient.create()) {
           GetIndexRequest request =
               GetIndexRequest.newBuilder()
                   .setName(IndexName.of("[PROJECT]", "[LOCATION]", "[INDEX]").toString())
                   .build();
           ApiFuture<Index> future = indexServiceClient.getIndexCallable().futureCall(request);
           // Do something.
           Index response = future.get();
         }
         
      • listIndexes

        public final IndexServiceClient.ListIndexesPagedResponse listIndexes​(LocationName parent)
        Lists Indexes 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 (IndexServiceClient indexServiceClient = IndexServiceClient.create()) {
           LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]");
           for (Index element : indexServiceClient.listIndexes(parent).iterateAll()) {
             // doThingsWith(element);
           }
         }
         
        Parameters:
        parent - Required. The resource name of the Location from which to list the Indexes. Format: `projects/{project}/locations/{location}`
        Throws:
        com.google.api.gax.rpc.ApiException - if the remote call fails
      • listIndexes

        public final IndexServiceClient.ListIndexesPagedResponse listIndexes​(String parent)
        Lists Indexes 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 (IndexServiceClient indexServiceClient = IndexServiceClient.create()) {
           String parent = LocationName.of("[PROJECT]", "[LOCATION]").toString();
           for (Index element : indexServiceClient.listIndexes(parent).iterateAll()) {
             // doThingsWith(element);
           }
         }
         
        Parameters:
        parent - Required. The resource name of the Location from which to list the Indexes. Format: `projects/{project}/locations/{location}`
        Throws:
        com.google.api.gax.rpc.ApiException - if the remote call fails
      • listIndexes

        public final IndexServiceClient.ListIndexesPagedResponse listIndexes​(ListIndexesRequest request)
        Lists Indexes 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 (IndexServiceClient indexServiceClient = IndexServiceClient.create()) {
           ListIndexesRequest request =
               ListIndexesRequest.newBuilder()
                   .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString())
                   .setFilter("filter-1274492040")
                   .setPageSize(883849137)
                   .setPageToken("pageToken873572522")
                   .setReadMask(FieldMask.newBuilder().build())
                   .build();
           for (Index element : indexServiceClient.listIndexes(request).iterateAll()) {
             // doThingsWith(element);
           }
         }
         
        Parameters:
        request - The request object containing all of the parameters for the API call.
        Throws:
        com.google.api.gax.rpc.ApiException - if the remote call fails
      • listIndexesPagedCallable

        public final com.google.api.gax.rpc.UnaryCallable<ListIndexesRequest,​IndexServiceClient.ListIndexesPagedResponse> listIndexesPagedCallable()
        Lists Indexes 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 (IndexServiceClient indexServiceClient = IndexServiceClient.create()) {
           ListIndexesRequest request =
               ListIndexesRequest.newBuilder()
                   .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString())
                   .setFilter("filter-1274492040")
                   .setPageSize(883849137)
                   .setPageToken("pageToken873572522")
                   .setReadMask(FieldMask.newBuilder().build())
                   .build();
           ApiFuture<Index> future = indexServiceClient.listIndexesPagedCallable().futureCall(request);
           // Do something.
           for (Index element : future.get().iterateAll()) {
             // doThingsWith(element);
           }
         }
         
      • listIndexesCallable

        public final com.google.api.gax.rpc.UnaryCallable<ListIndexesRequest,​ListIndexesResponse> listIndexesCallable()
        Lists Indexes 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 (IndexServiceClient indexServiceClient = IndexServiceClient.create()) {
           ListIndexesRequest request =
               ListIndexesRequest.newBuilder()
                   .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString())
                   .setFilter("filter-1274492040")
                   .setPageSize(883849137)
                   .setPageToken("pageToken873572522")
                   .setReadMask(FieldMask.newBuilder().build())
                   .build();
           while (true) {
             ListIndexesResponse response = indexServiceClient.listIndexesCallable().call(request);
             for (Index element : response.getIndexesList()) {
               // doThingsWith(element);
             }
             String nextPageToken = response.getNextPageToken();
             if (!Strings.isNullOrEmpty(nextPageToken)) {
               request = request.toBuilder().setPageToken(nextPageToken).build();
             } else {
               break;
             }
           }
         }
         
      • updateIndexAsync

        public final com.google.api.gax.longrunning.OperationFuture<Index,​UpdateIndexOperationMetadata> updateIndexAsync​(Index index,
                                                                                                                               com.google.protobuf.FieldMask updateMask)
        Updates an Index.

        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 (IndexServiceClient indexServiceClient = IndexServiceClient.create()) {
           Index index = Index.newBuilder().build();
           FieldMask updateMask = FieldMask.newBuilder().build();
           Index response = indexServiceClient.updateIndexAsync(index, updateMask).get();
         }
         
        Parameters:
        index - Required. The Index which updates the resource on the server.
        updateMask - The update mask applies to the resource. For the `FieldMask` definition, see [google.protobuf.FieldMask][google.protobuf.FieldMask].
        Throws:
        com.google.api.gax.rpc.ApiException - if the remote call fails
      • updateIndexAsync

        public final com.google.api.gax.longrunning.OperationFuture<Index,​UpdateIndexOperationMetadata> updateIndexAsync​(UpdateIndexRequest request)
        Updates an Index.

        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 (IndexServiceClient indexServiceClient = IndexServiceClient.create()) {
           UpdateIndexRequest request =
               UpdateIndexRequest.newBuilder()
                   .setIndex(Index.newBuilder().build())
                   .setUpdateMask(FieldMask.newBuilder().build())
                   .build();
           Index response = indexServiceClient.updateIndexAsync(request).get();
         }
         
        Parameters:
        request - The request object containing all of the parameters for the API call.
        Throws:
        com.google.api.gax.rpc.ApiException - if the remote call fails
      • updateIndexOperationCallable

        public final com.google.api.gax.rpc.OperationCallable<UpdateIndexRequest,​Index,​UpdateIndexOperationMetadata> updateIndexOperationCallable()
        Updates an Index.

        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 (IndexServiceClient indexServiceClient = IndexServiceClient.create()) {
           UpdateIndexRequest request =
               UpdateIndexRequest.newBuilder()
                   .setIndex(Index.newBuilder().build())
                   .setUpdateMask(FieldMask.newBuilder().build())
                   .build();
           OperationFuture<Index, UpdateIndexOperationMetadata> future =
               indexServiceClient.updateIndexOperationCallable().futureCall(request);
           // Do something.
           Index response = future.get();
         }
         
      • updateIndexCallable

        public final com.google.api.gax.rpc.UnaryCallable<UpdateIndexRequest,​com.google.longrunning.Operation> updateIndexCallable()
        Updates an Index.

        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 (IndexServiceClient indexServiceClient = IndexServiceClient.create()) {
           UpdateIndexRequest request =
               UpdateIndexRequest.newBuilder()
                   .setIndex(Index.newBuilder().build())
                   .setUpdateMask(FieldMask.newBuilder().build())
                   .build();
           ApiFuture<Operation> future = indexServiceClient.updateIndexCallable().futureCall(request);
           // Do something.
           Operation response = future.get();
         }
         
      • deleteIndexAsync

        public final com.google.api.gax.longrunning.OperationFuture<com.google.protobuf.Empty,​DeleteOperationMetadata> deleteIndexAsync​(IndexName name)
        Deletes an Index. An Index can only be deleted when all its [DeployedIndexes][google.cloud.aiplatform.v1.Index.deployed_indexes] had been undeployed.

        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 (IndexServiceClient indexServiceClient = IndexServiceClient.create()) {
           IndexName name = IndexName.of("[PROJECT]", "[LOCATION]", "[INDEX]");
           indexServiceClient.deleteIndexAsync(name).get();
         }
         
        Parameters:
        name - Required. The name of the Index resource to be deleted. Format: `projects/{project}/locations/{location}/indexes/{index}`
        Throws:
        com.google.api.gax.rpc.ApiException - if the remote call fails
      • deleteIndexAsync

        public final com.google.api.gax.longrunning.OperationFuture<com.google.protobuf.Empty,​DeleteOperationMetadata> deleteIndexAsync​(String name)
        Deletes an Index. An Index can only be deleted when all its [DeployedIndexes][google.cloud.aiplatform.v1.Index.deployed_indexes] had been undeployed.

        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 (IndexServiceClient indexServiceClient = IndexServiceClient.create()) {
           String name = IndexName.of("[PROJECT]", "[LOCATION]", "[INDEX]").toString();
           indexServiceClient.deleteIndexAsync(name).get();
         }
         
        Parameters:
        name - Required. The name of the Index resource to be deleted. Format: `projects/{project}/locations/{location}/indexes/{index}`
        Throws:
        com.google.api.gax.rpc.ApiException - if the remote call fails
      • deleteIndexAsync

        public final com.google.api.gax.longrunning.OperationFuture<com.google.protobuf.Empty,​DeleteOperationMetadata> deleteIndexAsync​(DeleteIndexRequest request)
        Deletes an Index. An Index can only be deleted when all its [DeployedIndexes][google.cloud.aiplatform.v1.Index.deployed_indexes] had been undeployed.

        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 (IndexServiceClient indexServiceClient = IndexServiceClient.create()) {
           DeleteIndexRequest request =
               DeleteIndexRequest.newBuilder()
                   .setName(IndexName.of("[PROJECT]", "[LOCATION]", "[INDEX]").toString())
                   .build();
           indexServiceClient.deleteIndexAsync(request).get();
         }
         
        Parameters:
        request - The request object containing all of the parameters for the API call.
        Throws:
        com.google.api.gax.rpc.ApiException - if the remote call fails
      • deleteIndexOperationCallable

        public final com.google.api.gax.rpc.OperationCallable<DeleteIndexRequest,​com.google.protobuf.Empty,​DeleteOperationMetadata> deleteIndexOperationCallable()
        Deletes an Index. An Index can only be deleted when all its [DeployedIndexes][google.cloud.aiplatform.v1.Index.deployed_indexes] had been undeployed.

        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 (IndexServiceClient indexServiceClient = IndexServiceClient.create()) {
           DeleteIndexRequest request =
               DeleteIndexRequest.newBuilder()
                   .setName(IndexName.of("[PROJECT]", "[LOCATION]", "[INDEX]").toString())
                   .build();
           OperationFuture<Empty, DeleteOperationMetadata> future =
               indexServiceClient.deleteIndexOperationCallable().futureCall(request);
           // Do something.
           future.get();
         }
         
      • deleteIndexCallable

        public final com.google.api.gax.rpc.UnaryCallable<DeleteIndexRequest,​com.google.longrunning.Operation> deleteIndexCallable()
        Deletes an Index. An Index can only be deleted when all its [DeployedIndexes][google.cloud.aiplatform.v1.Index.deployed_indexes] had been undeployed.

        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 (IndexServiceClient indexServiceClient = IndexServiceClient.create()) {
           DeleteIndexRequest request =
               DeleteIndexRequest.newBuilder()
                   .setName(IndexName.of("[PROJECT]", "[LOCATION]", "[INDEX]").toString())
                   .build();
           ApiFuture<Operation> future = indexServiceClient.deleteIndexCallable().futureCall(request);
           // Do something.
           future.get();
         }
         
      • upsertDatapoints

        public final UpsertDatapointsResponse upsertDatapoints​(UpsertDatapointsRequest request)
        Add/update Datapoints into an Index.

        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 (IndexServiceClient indexServiceClient = IndexServiceClient.create()) {
           UpsertDatapointsRequest request =
               UpsertDatapointsRequest.newBuilder()
                   .setIndex(IndexName.of("[PROJECT]", "[LOCATION]", "[INDEX]").toString())
                   .addAllDatapoints(new ArrayList<IndexDatapoint>())
                   .build();
           UpsertDatapointsResponse response = indexServiceClient.upsertDatapoints(request);
         }
         
        Parameters:
        request - The request object containing all of the parameters for the API call.
        Throws:
        com.google.api.gax.rpc.ApiException - if the remote call fails
      • upsertDatapointsCallable

        public final com.google.api.gax.rpc.UnaryCallable<UpsertDatapointsRequest,​UpsertDatapointsResponse> upsertDatapointsCallable()
        Add/update Datapoints into an Index.

        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 (IndexServiceClient indexServiceClient = IndexServiceClient.create()) {
           UpsertDatapointsRequest request =
               UpsertDatapointsRequest.newBuilder()
                   .setIndex(IndexName.of("[PROJECT]", "[LOCATION]", "[INDEX]").toString())
                   .addAllDatapoints(new ArrayList<IndexDatapoint>())
                   .build();
           ApiFuture<UpsertDatapointsResponse> future =
               indexServiceClient.upsertDatapointsCallable().futureCall(request);
           // Do something.
           UpsertDatapointsResponse response = future.get();
         }
         
      • removeDatapoints

        public final RemoveDatapointsResponse removeDatapoints​(RemoveDatapointsRequest request)
        Remove Datapoints from an Index.

        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 (IndexServiceClient indexServiceClient = IndexServiceClient.create()) {
           RemoveDatapointsRequest request =
               RemoveDatapointsRequest.newBuilder()
                   .setIndex(IndexName.of("[PROJECT]", "[LOCATION]", "[INDEX]").toString())
                   .addAllDatapointIds(new ArrayList<String>())
                   .build();
           RemoveDatapointsResponse response = indexServiceClient.removeDatapoints(request);
         }
         
        Parameters:
        request - The request object containing all of the parameters for the API call.
        Throws:
        com.google.api.gax.rpc.ApiException - if the remote call fails
      • removeDatapointsCallable

        public final com.google.api.gax.rpc.UnaryCallable<RemoveDatapointsRequest,​RemoveDatapointsResponse> removeDatapointsCallable()
        Remove Datapoints from an Index.

        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 (IndexServiceClient indexServiceClient = IndexServiceClient.create()) {
           RemoveDatapointsRequest request =
               RemoveDatapointsRequest.newBuilder()
                   .setIndex(IndexName.of("[PROJECT]", "[LOCATION]", "[INDEX]").toString())
                   .addAllDatapointIds(new ArrayList<String>())
                   .build();
           ApiFuture<RemoveDatapointsResponse> future =
               indexServiceClient.removeDatapointsCallable().futureCall(request);
           // Do something.
           RemoveDatapointsResponse response = future.get();
         }
         
      • listLocations

        public final IndexServiceClient.ListLocationsPagedResponse listLocations​(com.google.cloud.location.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 (IndexServiceClient indexServiceClient = IndexServiceClient.create()) {
           ListLocationsRequest request =
               ListLocationsRequest.newBuilder()
                   .setName("name3373707")
                   .setFilter("filter-1274492040")
                   .setPageSize(883849137)
                   .setPageToken("pageToken873572522")
                   .build();
           for (Location element : indexServiceClient.listLocations(request).iterateAll()) {
             // doThingsWith(element);
           }
         }
         
        Parameters:
        request - The request object containing all of the parameters for the API call.
        Throws:
        com.google.api.gax.rpc.ApiException - if the remote call fails
      • listLocationsPagedCallable

        public final com.google.api.gax.rpc.UnaryCallable<com.google.cloud.location.ListLocationsRequest,​IndexServiceClient.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 (IndexServiceClient indexServiceClient = IndexServiceClient.create()) {
           ListLocationsRequest request =
               ListLocationsRequest.newBuilder()
                   .setName("name3373707")
                   .setFilter("filter-1274492040")
                   .setPageSize(883849137)
                   .setPageToken("pageToken873572522")
                   .build();
           ApiFuture<Location> future =
               indexServiceClient.listLocationsPagedCallable().futureCall(request);
           // Do something.
           for (Location element : future.get().iterateAll()) {
             // doThingsWith(element);
           }
         }
         
      • listLocationsCallable

        public final com.google.api.gax.rpc.UnaryCallable<com.google.cloud.location.ListLocationsRequest,​com.google.cloud.location.ListLocationsResponse> listLocationsCallable()
        Lists information about the supported locations for this service.

        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 (IndexServiceClient indexServiceClient = IndexServiceClient.create()) {
           ListLocationsRequest request =
               ListLocationsRequest.newBuilder()
                   .setName("name3373707")
                   .setFilter("filter-1274492040")
                   .setPageSize(883849137)
                   .setPageToken("pageToken873572522")
                   .build();
           while (true) {
             ListLocationsResponse response = indexServiceClient.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 com.google.cloud.location.Location getLocation​(com.google.cloud.location.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 (IndexServiceClient indexServiceClient = IndexServiceClient.create()) {
           GetLocationRequest request = GetLocationRequest.newBuilder().setName("name3373707").build();
           Location response = indexServiceClient.getLocation(request);
         }
         
        Parameters:
        request - The request object containing all of the parameters for the API call.
        Throws:
        com.google.api.gax.rpc.ApiException - if the remote call fails
      • getLocationCallable

        public final com.google.api.gax.rpc.UnaryCallable<com.google.cloud.location.GetLocationRequest,​com.google.cloud.location.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 (IndexServiceClient indexServiceClient = IndexServiceClient.create()) {
           GetLocationRequest request = GetLocationRequest.newBuilder().setName("name3373707").build();
           ApiFuture<Location> future = indexServiceClient.getLocationCallable().futureCall(request);
           // Do something.
           Location response = future.get();
         }
         
      • setIamPolicy

        public final com.google.iam.v1.Policy setIamPolicy​(com.google.iam.v1.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 (IndexServiceClient indexServiceClient = IndexServiceClient.create()) {
           SetIamPolicyRequest request =
               SetIamPolicyRequest.newBuilder()
                   .setResource(
                       EndpointName.ofProjectLocationEndpointName(
                               "[PROJECT]", "[LOCATION]", "[ENDPOINT]")
                           .toString())
                   .setPolicy(Policy.newBuilder().build())
                   .setUpdateMask(FieldMask.newBuilder().build())
                   .build();
           Policy response = indexServiceClient.setIamPolicy(request);
         }
         
        Parameters:
        request - The request object containing all of the parameters for the API call.
        Throws:
        com.google.api.gax.rpc.ApiException - if the remote call fails
      • setIamPolicyCallable

        public final com.google.api.gax.rpc.UnaryCallable<com.google.iam.v1.SetIamPolicyRequest,​com.google.iam.v1.Policy> setIamPolicyCallable()
        Sets the access control policy on the specified resource. 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 (IndexServiceClient indexServiceClient = IndexServiceClient.create()) {
           SetIamPolicyRequest request =
               SetIamPolicyRequest.newBuilder()
                   .setResource(
                       EndpointName.ofProjectLocationEndpointName(
                               "[PROJECT]", "[LOCATION]", "[ENDPOINT]")
                           .toString())
                   .setPolicy(Policy.newBuilder().build())
                   .setUpdateMask(FieldMask.newBuilder().build())
                   .build();
           ApiFuture<Policy> future = indexServiceClient.setIamPolicyCallable().futureCall(request);
           // Do something.
           Policy response = future.get();
         }
         
      • getIamPolicy

        public final com.google.iam.v1.Policy getIamPolicy​(com.google.iam.v1.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 (IndexServiceClient indexServiceClient = IndexServiceClient.create()) {
           GetIamPolicyRequest request =
               GetIamPolicyRequest.newBuilder()
                   .setResource(
                       EndpointName.ofProjectLocationEndpointName(
                               "[PROJECT]", "[LOCATION]", "[ENDPOINT]")
                           .toString())
                   .setOptions(GetPolicyOptions.newBuilder().build())
                   .build();
           Policy response = indexServiceClient.getIamPolicy(request);
         }
         
        Parameters:
        request - The request object containing all of the parameters for the API call.
        Throws:
        com.google.api.gax.rpc.ApiException - if the remote call fails
      • getIamPolicyCallable

        public final com.google.api.gax.rpc.UnaryCallable<com.google.iam.v1.GetIamPolicyRequest,​com.google.iam.v1.Policy> getIamPolicyCallable()
        Gets the access control policy for a resource. 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 (IndexServiceClient indexServiceClient = IndexServiceClient.create()) {
           GetIamPolicyRequest request =
               GetIamPolicyRequest.newBuilder()
                   .setResource(
                       EndpointName.ofProjectLocationEndpointName(
                               "[PROJECT]", "[LOCATION]", "[ENDPOINT]")
                           .toString())
                   .setOptions(GetPolicyOptions.newBuilder().build())
                   .build();
           ApiFuture<Policy> future = indexServiceClient.getIamPolicyCallable().futureCall(request);
           // Do something.
           Policy response = future.get();
         }
         
      • testIamPermissions

        public final com.google.iam.v1.TestIamPermissionsResponse testIamPermissions​(com.google.iam.v1.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 (IndexServiceClient indexServiceClient = IndexServiceClient.create()) {
           TestIamPermissionsRequest request =
               TestIamPermissionsRequest.newBuilder()
                   .setResource(
                       EndpointName.ofProjectLocationEndpointName(
                               "[PROJECT]", "[LOCATION]", "[ENDPOINT]")
                           .toString())
                   .addAllPermissions(new ArrayList<String>())
                   .build();
           TestIamPermissionsResponse response = indexServiceClient.testIamPermissions(request);
         }
         
        Parameters:
        request - The request object containing all of the parameters for the API call.
        Throws:
        com.google.api.gax.rpc.ApiException - if the remote call fails
      • testIamPermissionsCallable

        public final com.google.api.gax.rpc.UnaryCallable<com.google.iam.v1.TestIamPermissionsRequest,​com.google.iam.v1.TestIamPermissionsResponse> testIamPermissionsCallable()
        Returns permissions that a caller has on the specified resource. 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 (IndexServiceClient indexServiceClient = IndexServiceClient.create()) {
           TestIamPermissionsRequest request =
               TestIamPermissionsRequest.newBuilder()
                   .setResource(
                       EndpointName.ofProjectLocationEndpointName(
                               "[PROJECT]", "[LOCATION]", "[ENDPOINT]")
                           .toString())
                   .addAllPermissions(new ArrayList<String>())
                   .build();
           ApiFuture<TestIamPermissionsResponse> future =
               indexServiceClient.testIamPermissionsCallable().futureCall(request);
           // Do something.
           TestIamPermissionsResponse response = future.get();
         }
         
      • shutdown

        public void shutdown()
        Specified by:
        shutdown in interface com.google.api.gax.core.BackgroundResource
      • isShutdown

        public boolean isShutdown()
        Specified by:
        isShutdown in interface com.google.api.gax.core.BackgroundResource
      • isTerminated

        public boolean isTerminated()
        Specified by:
        isTerminated in interface com.google.api.gax.core.BackgroundResource
      • shutdownNow

        public void shutdownNow()
        Specified by:
        shutdownNow in interface com.google.api.gax.core.BackgroundResource