- 3.54.0 (latest)
- 3.53.0
- 3.52.0
- 3.50.0
- 3.49.0
- 3.48.0
- 3.47.0
- 3.46.0
- 3.45.0
- 3.44.0
- 3.43.0
- 3.42.0
- 3.41.0
- 3.40.0
- 3.38.0
- 3.37.0
- 3.36.0
- 3.35.0
- 3.34.0
- 3.33.0
- 3.32.0
- 3.31.0
- 3.30.0
- 3.29.0
- 3.28.0
- 3.25.0
- 3.24.0
- 3.23.0
- 3.22.0
- 3.21.0
- 3.20.0
- 3.19.0
- 3.18.0
- 3.17.0
- 3.16.0
- 3.15.0
- 3.14.0
- 3.13.0
- 3.12.0
- 3.11.0
- 3.10.0
- 3.9.0
- 3.8.0
- 3.7.0
- 3.6.0
- 3.5.0
- 3.4.2
- 3.3.0
- 3.2.0
- 3.0.0
- 2.9.8
- 2.8.9
- 2.7.4
- 2.5.3
- 2.4.0
public class IndexServiceClient implements 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:
- 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.
- 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.
- 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.
Implements
BackgroundResourceStatic Methods
create()
public static final IndexServiceClient create()
Constructs an instance of IndexServiceClient with default settings.
Type | Description |
IndexServiceClient |
Type | Description |
IOException |
create(IndexServiceSettings settings)
public static final IndexServiceClient create(IndexServiceSettings settings)
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.
Name | Description |
settings | IndexServiceSettings |
Type | Description |
IndexServiceClient |
Type | Description |
IOException |
create(IndexServiceStub stub)
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).
Name | Description |
stub | IndexServiceStub |
Type | Description |
IndexServiceClient |
Constructors
IndexServiceClient(IndexServiceSettings settings)
protected IndexServiceClient(IndexServiceSettings settings)
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.
Name | Description |
settings | IndexServiceSettings |
IndexServiceClient(IndexServiceStub stub)
protected IndexServiceClient(IndexServiceStub stub)
Name | Description |
stub | IndexServiceStub |
Methods
awaitTermination(long duration, TimeUnit unit)
public boolean awaitTermination(long duration, TimeUnit unit)
Name | Description |
duration | long |
unit | TimeUnit |
Type | Description |
boolean |
Type | Description |
InterruptedException |
close()
public final void close()
createIndexAsync(CreateIndexRequest request)
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();
}
Name | Description |
request | CreateIndexRequest The request object containing all of the parameters for the API call. |
Type | Description |
OperationFuture<Index,CreateIndexOperationMetadata> |
createIndexAsync(LocationName parent, Index index)
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();
}
Name | Description |
parent | LocationName Required. The resource name of the Location to create the Index in. Format:
|
index | Index Required. The Index to create. |
Type | Description |
OperationFuture<Index,CreateIndexOperationMetadata> |
createIndexAsync(String parent, Index index)
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();
}
Name | Description |
parent | String Required. The resource name of the Location to create the Index in. Format:
|
index | Index Required. The Index to create. |
Type | Description |
OperationFuture<Index,CreateIndexOperationMetadata> |
createIndexCallable()
public final UnaryCallable<CreateIndexRequest,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();
}
Type | Description |
UnaryCallable<CreateIndexRequest,Operation> |
createIndexOperationCallable()
public final 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();
}
Type | Description |
OperationCallable<CreateIndexRequest,Index,CreateIndexOperationMetadata> |
deleteIndexAsync(DeleteIndexRequest request)
public final OperationFuture<Empty,DeleteOperationMetadata> deleteIndexAsync(DeleteIndexRequest request)
Deletes an Index. An Index can only be deleted when all its DeployedIndexes 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();
}
Name | Description |
request | DeleteIndexRequest The request object containing all of the parameters for the API call. |
Type | Description |
OperationFuture<Empty,DeleteOperationMetadata> |
deleteIndexAsync(IndexName name)
public final OperationFuture<Empty,DeleteOperationMetadata> deleteIndexAsync(IndexName name)
Deletes an Index. An Index can only be deleted when all its DeployedIndexes 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();
}
Name | Description |
name | IndexName Required. The name of the Index resource to be deleted. Format:
|
Type | Description |
OperationFuture<Empty,DeleteOperationMetadata> |
deleteIndexAsync(String name)
public final OperationFuture<Empty,DeleteOperationMetadata> deleteIndexAsync(String name)
Deletes an Index. An Index can only be deleted when all its DeployedIndexes 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();
}
Name | Description |
name | String Required. The name of the Index resource to be deleted. Format:
|
Type | Description |
OperationFuture<Empty,DeleteOperationMetadata> |
deleteIndexCallable()
public final UnaryCallable<DeleteIndexRequest,Operation> deleteIndexCallable()
Deletes an Index. An Index can only be deleted when all its DeployedIndexes 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();
}
Type | Description |
UnaryCallable<DeleteIndexRequest,Operation> |
deleteIndexOperationCallable()
public final OperationCallable<DeleteIndexRequest,Empty,DeleteOperationMetadata> deleteIndexOperationCallable()
Deletes an Index. An Index can only be deleted when all its DeployedIndexes 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();
}
Type | Description |
OperationCallable<DeleteIndexRequest,Empty,DeleteOperationMetadata> |
getIamPolicy(GetIamPolicyRequest request)
public final Policy getIamPolicy(GetIamPolicyRequest request)
Gets the access control policy for a resource. Returns an empty policyif the resource exists and does not have a policy set.
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (IndexServiceClient indexServiceClient = IndexServiceClient.create()) {
GetIamPolicyRequest request =
GetIamPolicyRequest.newBuilder()
.setResource(
EntityTypeName.of("[PROJECT]", "[LOCATION]", "[FEATURESTORE]", "[ENTITY_TYPE]")
.toString())
.setOptions(GetPolicyOptions.newBuilder().build())
.build();
Policy response = indexServiceClient.getIamPolicy(request);
}
Name | Description |
request | com.google.iam.v1.GetIamPolicyRequest The request object containing all of the parameters for the API call. |
Type | Description |
com.google.iam.v1.Policy |
getIamPolicyCallable()
public final UnaryCallable<GetIamPolicyRequest,Policy> getIamPolicyCallable()
Gets the access control policy for a resource. Returns an empty policyif the resource exists and does not have a policy set.
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (IndexServiceClient indexServiceClient = IndexServiceClient.create()) {
GetIamPolicyRequest request =
GetIamPolicyRequest.newBuilder()
.setResource(
EntityTypeName.of("[PROJECT]", "[LOCATION]", "[FEATURESTORE]", "[ENTITY_TYPE]")
.toString())
.setOptions(GetPolicyOptions.newBuilder().build())
.build();
ApiFuture<Policy> future = indexServiceClient.getIamPolicyCallable().futureCall(request);
// Do something.
Policy response = future.get();
}
Type | Description |
UnaryCallable<com.google.iam.v1.GetIamPolicyRequest,com.google.iam.v1.Policy> |
getIndex(GetIndexRequest request)
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);
}
Name | Description |
request | GetIndexRequest The request object containing all of the parameters for the API call. |
Type | Description |
Index |
getIndex(IndexName name)
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);
}
Name | Description |
name | IndexName Required. The name of the Index resource. Format:
|
Type | Description |
Index |
getIndex(String name)
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);
}
Name | Description |
name | String Required. The name of the Index resource. Format:
|
Type | Description |
Index |
getIndexCallable()
public final 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();
}
Type | Description |
UnaryCallable<GetIndexRequest,Index> |
getLocation(GetLocationRequest request)
public final Location getLocation(GetLocationRequest request)
Gets information about a location.
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (IndexServiceClient indexServiceClient = IndexServiceClient.create()) {
GetLocationRequest request = GetLocationRequest.newBuilder().setName("name3373707").build();
Location response = indexServiceClient.getLocation(request);
}
Name | Description |
request | com.google.cloud.location.GetLocationRequest The request object containing all of the parameters for the API call. |
Type | Description |
com.google.cloud.location.Location |
getLocationCallable()
public final UnaryCallable<GetLocationRequest,Location> getLocationCallable()
Gets information about a location.
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (IndexServiceClient indexServiceClient = IndexServiceClient.create()) {
GetLocationRequest request = GetLocationRequest.newBuilder().setName("name3373707").build();
ApiFuture<Location> future = indexServiceClient.getLocationCallable().futureCall(request);
// Do something.
Location response = future.get();
}
Type | Description |
UnaryCallable<com.google.cloud.location.GetLocationRequest,com.google.cloud.location.Location> |
getOperationsClient()
public final OperationsClient getOperationsClient()
Returns the OperationsClient that can be used to query the status of a long-running operation returned by another API method call.
Type | Description |
OperationsClient |
getSettings()
public final IndexServiceSettings getSettings()
Type | Description |
IndexServiceSettings |
getStub()
public IndexServiceStub getStub()
Type | Description |
IndexServiceStub |
isShutdown()
public boolean isShutdown()
Type | Description |
boolean |
isTerminated()
public boolean isTerminated()
Type | Description |
boolean |
listIndexes(ListIndexesRequest request)
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);
}
}
Name | Description |
request | ListIndexesRequest The request object containing all of the parameters for the API call. |
Type | Description |
IndexServiceClient.ListIndexesPagedResponse |
listIndexes(LocationName parent)
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);
}
}
Name | Description |
parent | LocationName Required. The resource name of the Location from which to list the Indexes.
Format: |
Type | Description |
IndexServiceClient.ListIndexesPagedResponse |
listIndexes(String parent)
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);
}
}
Name | Description |
parent | String Required. The resource name of the Location from which to list the Indexes.
Format: |
Type | Description |
IndexServiceClient.ListIndexesPagedResponse |
listIndexesCallable()
public final 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;
}
}
}
Type | Description |
UnaryCallable<ListIndexesRequest,ListIndexesResponse> |
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);
}
}
Type | Description |
UnaryCallable<ListIndexesRequest,ListIndexesPagedResponse> |
listLocations(ListLocationsRequest request)
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);
}
}
Name | Description |
request | com.google.cloud.location.ListLocationsRequest The request object containing all of the parameters for the API call. |
Type | Description |
IndexServiceClient.ListLocationsPagedResponse |
listLocationsCallable()
public final UnaryCallable<ListLocationsRequest,ListLocationsResponse> listLocationsCallable()
Lists information about the supported locations for this service.
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (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;
}
}
}
Type | Description |
UnaryCallable<com.google.cloud.location.ListLocationsRequest,com.google.cloud.location.ListLocationsResponse> |
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);
}
}
Type | Description |
UnaryCallable<com.google.cloud.location.ListLocationsRequest,ListLocationsPagedResponse> |
removeDatapoints(RemoveDatapointsRequest request)
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);
}
Name | Description |
request | RemoveDatapointsRequest The request object containing all of the parameters for the API call. |
Type | Description |
RemoveDatapointsResponse |
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();
}
Type | Description |
UnaryCallable<RemoveDatapointsRequest,RemoveDatapointsResponse> |
setIamPolicy(SetIamPolicyRequest request)
public final Policy setIamPolicy(SetIamPolicyRequest request)
Sets the access control policy on the specified resource. Replacesany existing policy.
Can return NOT_FOUND
, INVALID_ARGUMENT
, and PERMISSION_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(
EntityTypeName.of("[PROJECT]", "[LOCATION]", "[FEATURESTORE]", "[ENTITY_TYPE]")
.toString())
.setPolicy(Policy.newBuilder().build())
.setUpdateMask(FieldMask.newBuilder().build())
.build();
Policy response = indexServiceClient.setIamPolicy(request);
}
Name | Description |
request | com.google.iam.v1.SetIamPolicyRequest The request object containing all of the parameters for the API call. |
Type | Description |
com.google.iam.v1.Policy |
setIamPolicyCallable()
public final UnaryCallable<SetIamPolicyRequest,Policy> setIamPolicyCallable()
Sets the access control policy on the specified resource. Replacesany existing policy.
Can return NOT_FOUND
, INVALID_ARGUMENT
, and PERMISSION_DENIED
errors.
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (IndexServiceClient indexServiceClient = IndexServiceClient.create()) {
SetIamPolicyRequest request =
SetIamPolicyRequest.newBuilder()
.setResource(
EntityTypeName.of("[PROJECT]", "[LOCATION]", "[FEATURESTORE]", "[ENTITY_TYPE]")
.toString())
.setPolicy(Policy.newBuilder().build())
.setUpdateMask(FieldMask.newBuilder().build())
.build();
ApiFuture<Policy> future = indexServiceClient.setIamPolicyCallable().futureCall(request);
// Do something.
Policy response = future.get();
}
Type | Description |
UnaryCallable<com.google.iam.v1.SetIamPolicyRequest,com.google.iam.v1.Policy> |
shutdown()
public void shutdown()
shutdownNow()
public void shutdownNow()
testIamPermissions(TestIamPermissionsRequest request)
public final TestIamPermissionsResponse testIamPermissions(TestIamPermissionsRequest request)
Returns permissions that a caller has on the specified resource. If theresource does not exist,
this will return an empty set ofpermissions, not a NOT_FOUND
error.
Note: This operation is designed to be used for buildingpermission-aware UIs and command-line tools, not for authorizationchecking. This operation may "fail open" without warning.
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (IndexServiceClient indexServiceClient = IndexServiceClient.create()) {
TestIamPermissionsRequest request =
TestIamPermissionsRequest.newBuilder()
.setResource(
EntityTypeName.of("[PROJECT]", "[LOCATION]", "[FEATURESTORE]", "[ENTITY_TYPE]")
.toString())
.addAllPermissions(new ArrayList<String>())
.build();
TestIamPermissionsResponse response = indexServiceClient.testIamPermissions(request);
}
Name | Description |
request | com.google.iam.v1.TestIamPermissionsRequest The request object containing all of the parameters for the API call. |
Type | Description |
com.google.iam.v1.TestIamPermissionsResponse |
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(
EntityTypeName.of("[PROJECT]", "[LOCATION]", "[FEATURESTORE]", "[ENTITY_TYPE]")
.toString())
.addAllPermissions(new ArrayList<String>())
.build();
ApiFuture<TestIamPermissionsResponse> future =
indexServiceClient.testIamPermissionsCallable().futureCall(request);
// Do something.
TestIamPermissionsResponse response = future.get();
}
Type | Description |
UnaryCallable<com.google.iam.v1.TestIamPermissionsRequest,com.google.iam.v1.TestIamPermissionsResponse> |
updateIndexAsync(Index index, FieldMask updateMask)
public final OperationFuture<Index,UpdateIndexOperationMetadata> updateIndexAsync(Index index, 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();
}
Name | Description |
index | Index Required. The Index which updates the resource on the server. |
updateMask | FieldMask The update mask applies to the resource. For the |
Type | Description |
OperationFuture<Index,UpdateIndexOperationMetadata> |
updateIndexAsync(UpdateIndexRequest request)
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();
}
Name | Description |
request | UpdateIndexRequest The request object containing all of the parameters for the API call. |
Type | Description |
OperationFuture<Index,UpdateIndexOperationMetadata> |
updateIndexCallable()
public final UnaryCallable<UpdateIndexRequest,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();
}
Type | Description |
UnaryCallable<UpdateIndexRequest,Operation> |
updateIndexOperationCallable()
public final 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();
}
Type | Description |
OperationCallable<UpdateIndexRequest,Index,UpdateIndexOperationMetadata> |
upsertDatapoints(UpsertDatapointsRequest request)
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);
}
Name | Description |
request | UpsertDatapointsRequest The request object containing all of the parameters for the API call. |
Type | Description |
UpsertDatapointsResponse |
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>())
.build();
ApiFuture<UpsertDatapointsResponse> future =
indexServiceClient.upsertDatapointsCallable().futureCall(request);
// Do something.
UpsertDatapointsResponse response = future.get();
}
Type | Description |
UnaryCallable<UpsertDatapointsRequest,UpsertDatapointsResponse> |