Class IndexServiceClient
- All Implemented Interfaces:
BackgroundResource,AutoCloseable
This class provides the ability to make remote calls to the backing service through method calls that map to API methods. Sample code to get started:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (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().
| Method | Description | Method Variants |
|---|---|---|
CreateIndex |
Creates an Index. |
Request object method variants only take one parameter, a request object, which must be constructed before the call.
Methods that return long-running operations have "Async" method variants that return `OperationFuture`, which is used to track polling of the service.
Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.
|
GetIndex |
Gets an Index. |
Request object method variants only take one parameter, a request object, which must be constructed before the call.
"Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method.
Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.
|
ImportIndex |
Imports an Index from an external source (e.g., BigQuery). |
Request object method variants only take one parameter, a request object, which must be constructed before the call.
Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.
|
ListIndexes |
Lists Indexes in a Location. |
Request object method variants only take one parameter, a request object, which must be constructed before the call.
"Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method.
Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.
|
UpdateIndex |
Updates an Index. |
Request object method variants only take one parameter, a request object, which must be constructed before the call.
Methods that return long-running operations have "Async" method variants that return `OperationFuture`, which is used to track polling of the service.
Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.
|
DeleteIndex |
Deletes an Index. An Index can only be deleted when all its [DeployedIndexes][google.cloud.aiplatform.v1beta1.Index.deployed_indexes] had been undeployed. |
Request object method variants only take one parameter, a request object, which must be constructed before the call.
Methods that return long-running operations have "Async" method variants that return `OperationFuture`, which is used to track polling of the service.
Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.
|
UpsertDatapoints |
Add/update Datapoints into an Index. |
Request object method variants only take one parameter, a request object, which must be constructed before the call.
Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.
|
RemoveDatapoints |
Remove Datapoints from an Index. |
Request object method variants only take one parameter, a request object, which must be constructed before the call.
Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.
|
ListLocations |
Lists information about the supported locations for this service. |
Request object method variants only take one parameter, a request object, which must be constructed before the call.
Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.
|
GetLocation |
Gets information about a location. |
Request object method variants only take one parameter, a request object, which must be constructed before the call.
Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.
|
SetIamPolicy |
Sets the access control policy on the specified resource. Replacesany existing policy. Can return `NOT_FOUND`, `INVALID_ARGUMENT`, and `PERMISSION_DENIED`errors. |
Request object method variants only take one parameter, a request object, which must be constructed before the call.
Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.
|
GetIamPolicy |
Gets the access control policy for a resource. Returns an empty policyif the resource exists and does not have a policy set. |
Request object method variants only take one parameter, a request object, which must be constructed before the call.
Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.
|
TestIamPermissions |
Returns permissions that a caller has on the specified resource. If theresource does not exist, this will return an empty set ofpermissions, not a `NOT_FOUND` error. Note: This operation is designed to be used for buildingpermission-aware UIs and command-line tools, not for authorizationchecking. This operation may "fail open" without warning. |
Request object method variants only take one parameter, a request object, which must be constructed before the call.
Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.
|
See the individual methods for example code.
Many parameters require resource names to be formatted in a particular way. To assist with these names, this class includes a format method for each type of name, and additionally a parse method to extract the individual identifiers contained within names that are returned.
This class can be customized by passing in a custom instance of 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.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classstatic classstatic classstatic classstatic classstatic class -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedIndexServiceClient(IndexServiceSettings settings) Constructs an instance of IndexServiceClient, using the given settings.protected -
Method Summary
Modifier and TypeMethodDescriptionbooleanawaitTermination(long duration, TimeUnit unit) final voidclose()static final IndexServiceClientcreate()Constructs an instance of IndexServiceClient with default settings.static final IndexServiceClientcreate(IndexServiceSettings settings) Constructs an instance of IndexServiceClient, using the given settings.static final IndexServiceClientcreate(IndexServiceStub stub) Constructs an instance of IndexServiceClient, using the given stub for making calls.createIndexAsync(CreateIndexRequest request) Creates an Index.createIndexAsync(LocationName parent, Index index) Creates an Index.createIndexAsync(String parent, Index index) Creates an Index.Creates an Index.Creates an Index.final OperationFuture<com.google.protobuf.Empty,DeleteOperationMetadata> deleteIndexAsync(DeleteIndexRequest request) Deletes an Index.final OperationFuture<com.google.protobuf.Empty,DeleteOperationMetadata> deleteIndexAsync(IndexName name) Deletes an Index.final OperationFuture<com.google.protobuf.Empty,DeleteOperationMetadata> deleteIndexAsync(String name) Deletes an Index.Deletes an Index.final OperationCallable<DeleteIndexRequest,com.google.protobuf.Empty, DeleteOperationMetadata> Deletes an Index.final PolicygetIamPolicy(GetIamPolicyRequest request) Gets the access control policy for a resource.Gets the access control policy for a resource.final IndexgetIndex(GetIndexRequest request) Gets an Index.final IndexGets an Index.final IndexGets an Index.final UnaryCallable<GetIndexRequest,Index> Gets an Index.final LocationgetLocation(GetLocationRequest request) Gets information about a location.Gets information about a location.final OperationsClientReturns the OperationsClient that can be used to query the status of a long-running operation returned by another API method call.final IndexServiceSettingsgetStub()importIndexAsync(ImportIndexRequest request) Imports an Index from an external source (e.g., BigQuery).Imports an Index from an external source (e.g., BigQuery).Imports an Index from an external source (e.g., BigQuery).booleanbooleanlistIndexes(ListIndexesRequest request) Lists Indexes in a Location.listIndexes(LocationName parent) Lists Indexes in a Location.listIndexes(String parent) Lists Indexes in a Location.Lists Indexes in a Location.Lists Indexes in a Location.listLocations(ListLocationsRequest request) Lists information about the supported locations for this service.Lists information about the supported locations for this service.Lists information about the supported locations for this service.final RemoveDatapointsResponseremoveDatapoints(RemoveDatapointsRequest request) Remove Datapoints from an Index.Remove Datapoints from an Index.final PolicysetIamPolicy(SetIamPolicyRequest request) Sets the access control policy on the specified resource.Sets the access control policy on the specified resource.voidshutdown()voidReturns permissions that a caller has on the specified resource.Returns permissions that a caller has on the specified resource.updateIndexAsync(Index index, com.google.protobuf.FieldMask updateMask) Updates an Index.updateIndexAsync(UpdateIndexRequest request) Updates an Index.Updates an Index.Updates an Index.final UpsertDatapointsResponseupsertDatapoints(UpsertDatapointsRequest request) Add/update Datapoints into an Index.Add/update Datapoints into an Index.
-
Constructor Details
-
IndexServiceClient
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
-
IndexServiceClient
-
-
Method Details
-
create
Constructs an instance of IndexServiceClient with default settings.- Throws:
IOException
-
create
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
Constructs an instance of IndexServiceClient, using the given stub for making calls. This is for advanced usage - prefer using create(IndexServiceSettings). -
getSettings
-
getStub
-
getOperationsClient
Returns the OperationsClient that can be used to query the status of a long-running operation returned by another API method call. -
createIndexAsync
public final 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:
ApiException- if the remote call fails
-
createIndexAsync
public final 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:
ApiException- if the remote call fails
-
createIndexAsync
public final 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:
ApiException- if the remote call fails
-
createIndexOperationCallable
public final OperationCallable<CreateIndexRequest,Index, createIndexOperationCallable()CreateIndexOperationMetadata> 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
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
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:
ApiException- if the remote call fails
-
getIndex
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:
ApiException- if the remote call fails
-
getIndex
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:
ApiException- if the remote call fails
-
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(); } -
importIndexAsync
public final OperationFuture<Index,ImportIndexOperationMetadata> importIndexAsync(ImportIndexRequest request) Imports an Index from an external source (e.g., BigQuery).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()) { ImportIndexRequest request = ImportIndexRequest.newBuilder() .setName(IndexName.of("[PROJECT]", "[LOCATION]", "[INDEX]").toString()) .setIsCompleteOverwrite(true) .setConfig(ImportIndexRequest.ConnectorConfig.newBuilder().build()) .build(); Index response = indexServiceClient.importIndexAsync(request).get(); }- Parameters:
request- The request object containing all of the parameters for the API call.- Throws:
ApiException- if the remote call fails
-
importIndexOperationCallable
public final OperationCallable<ImportIndexRequest,Index, importIndexOperationCallable()ImportIndexOperationMetadata> Imports an Index from an external source (e.g., BigQuery).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()) { ImportIndexRequest request = ImportIndexRequest.newBuilder() .setName(IndexName.of("[PROJECT]", "[LOCATION]", "[INDEX]").toString()) .setIsCompleteOverwrite(true) .setConfig(ImportIndexRequest.ConnectorConfig.newBuilder().build()) .build(); OperationFuture<Index, ImportIndexOperationMetadata> future = indexServiceClient.importIndexOperationCallable().futureCall(request); // Do something. Index response = future.get(); } -
importIndexCallable
Imports an Index from an external source (e.g., BigQuery).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()) { ImportIndexRequest request = ImportIndexRequest.newBuilder() .setName(IndexName.of("[PROJECT]", "[LOCATION]", "[INDEX]").toString()) .setIsCompleteOverwrite(true) .setConfig(ImportIndexRequest.ConnectorConfig.newBuilder().build()) .build(); ApiFuture<Operation> future = indexServiceClient.importIndexCallable().futureCall(request); // Do something. Operation response = future.get(); } -
listIndexes
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:
ApiException- if the remote call fails
-
listIndexes
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:
ApiException- if the remote call fails
-
listIndexes
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:
ApiException- if the remote call fails
-
listIndexesPagedCallable
public final 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
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 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:
ApiException- if the remote call fails
-
updateIndexAsync
public final 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:
ApiException- if the remote call fails
-
updateIndexOperationCallable
public final OperationCallable<UpdateIndexRequest,Index, updateIndexOperationCallable()UpdateIndexOperationMetadata> 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
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 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.v1beta1.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:
ApiException- if the remote call fails
-
deleteIndexAsync
public final 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.v1beta1.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:
ApiException- if the remote call fails
-
deleteIndexAsync
public final 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.v1beta1.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:
ApiException- if the remote call fails
-
deleteIndexOperationCallable
public final OperationCallable<DeleteIndexRequest,com.google.protobuf.Empty, deleteIndexOperationCallable()DeleteOperationMetadata> Deletes an Index. An Index can only be deleted when all its [DeployedIndexes][google.cloud.aiplatform.v1beta1.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
Deletes an Index. An Index can only be deleted when all its [DeployedIndexes][google.cloud.aiplatform.v1beta1.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
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>()) .setUpdateMask(FieldMask.newBuilder().build()) .build(); UpsertDatapointsResponse response = indexServiceClient.upsertDatapoints(request); }- Parameters:
request- The request object containing all of the parameters for the API call.- Throws:
ApiException- if the remote call fails
-
upsertDatapointsCallable
public final 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>()) .setUpdateMask(FieldMask.newBuilder().build()) .build(); ApiFuture<UpsertDatapointsResponse> future = indexServiceClient.upsertDatapointsCallable().futureCall(request); // Do something. UpsertDatapointsResponse response = future.get(); } -
removeDatapoints
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:
ApiException- if the remote call fails
-
removeDatapointsCallable
public final 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(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:
ApiException- if the remote call fails
-
listLocationsPagedCallable
public final UnaryCallable<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
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
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:
ApiException- if the remote call fails
-
getLocationCallable
Gets information about a location.Sample code:
// This snippet has been automatically generated and should be regarded as a code template only. // It will require modifications to work: // - It may require correct/in-range values for request initialization. // - It may require specifying regional endpoints when creating the service client as shown in // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library try (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
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:
ApiException- if the remote call fails
-
setIamPolicyCallable
Sets the access control policy on the specified resource. Replacesany existing policy.Can return `NOT_FOUND`, `INVALID_ARGUMENT`, and `PERMISSION_DENIED`errors.
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only. // It will require modifications to work: // - It may require correct/in-range values for request initialization. // - It may require specifying regional endpoints when creating the service client as shown in // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library try (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
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:
ApiException- if the remote call fails
-
getIamPolicyCallable
Gets the access control policy for a resource. Returns an empty policyif the resource exists and does not have a policy set.Sample code:
// This snippet has been automatically generated and should be regarded as a code template only. // It will require modifications to work: // - It may require correct/in-range values for request initialization. // - It may require specifying regional endpoints when creating the service client as shown in // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library try (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
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:
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 (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(); } -
close
public final void close()- Specified by:
closein interfaceAutoCloseable
-
shutdown
public void shutdown()- Specified by:
shutdownin interfaceBackgroundResource
-
isShutdown
public boolean isShutdown()- Specified by:
isShutdownin interfaceBackgroundResource
-
isTerminated
public boolean isTerminated()- Specified by:
isTerminatedin interfaceBackgroundResource
-
shutdownNow
public void shutdownNow()- Specified by:
shutdownNowin interfaceBackgroundResource
-
awaitTermination
- Specified by:
awaitTerminationin interfaceBackgroundResource- Throws:
InterruptedException
-