@Generated(value="by gapic-generator-java") public class IndexServiceClient extends Object implements com.google.api.gax.core.BackgroundResource
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:
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.
| Modifier and Type | Class and Description |
|---|---|
static class |
IndexServiceClient.ListIndexesFixedSizeCollection |
static class |
IndexServiceClient.ListIndexesPage |
static class |
IndexServiceClient.ListIndexesPagedResponse |
static class |
IndexServiceClient.ListLocationsFixedSizeCollection |
static class |
IndexServiceClient.ListLocationsPage |
static class |
IndexServiceClient.ListLocationsPagedResponse |
| Modifier | Constructor and Description |
|---|---|
protected |
IndexServiceClient(IndexServiceSettings settings)
Constructs an instance of IndexServiceClient, using the given settings.
|
protected |
IndexServiceClient(IndexServiceStub stub) |
| Modifier and Type | Method and Description |
|---|---|
boolean |
awaitTermination(long duration,
TimeUnit unit) |
void |
close() |
static IndexServiceClient |
create()
Constructs an instance of IndexServiceClient with default settings.
|
static IndexServiceClient |
create(IndexServiceSettings settings)
Constructs an instance of IndexServiceClient, using the given settings.
|
static IndexServiceClient |
create(IndexServiceStub stub)
Constructs an instance of IndexServiceClient, using the given stub for making calls.
|
com.google.api.gax.longrunning.OperationFuture<Index,CreateIndexOperationMetadata> |
createIndexAsync(CreateIndexRequest request)
Creates an Index.
|
com.google.api.gax.longrunning.OperationFuture<Index,CreateIndexOperationMetadata> |
createIndexAsync(LocationName parent,
Index index)
Creates an Index.
|
com.google.api.gax.longrunning.OperationFuture<Index,CreateIndexOperationMetadata> |
createIndexAsync(String parent,
Index index)
Creates an Index.
|
com.google.api.gax.rpc.UnaryCallable<CreateIndexRequest,com.google.longrunning.Operation> |
createIndexCallable()
Creates an Index.
|
com.google.api.gax.rpc.OperationCallable<CreateIndexRequest,Index,CreateIndexOperationMetadata> |
createIndexOperationCallable()
Creates an Index.
|
com.google.api.gax.longrunning.OperationFuture<com.google.protobuf.Empty,DeleteOperationMetadata> |
deleteIndexAsync(DeleteIndexRequest request)
Deletes an Index.
|
com.google.api.gax.longrunning.OperationFuture<com.google.protobuf.Empty,DeleteOperationMetadata> |
deleteIndexAsync(IndexName name)
Deletes an Index.
|
com.google.api.gax.longrunning.OperationFuture<com.google.protobuf.Empty,DeleteOperationMetadata> |
deleteIndexAsync(String name)
Deletes an Index.
|
com.google.api.gax.rpc.UnaryCallable<DeleteIndexRequest,com.google.longrunning.Operation> |
deleteIndexCallable()
Deletes an Index.
|
com.google.api.gax.rpc.OperationCallable<DeleteIndexRequest,com.google.protobuf.Empty,DeleteOperationMetadata> |
deleteIndexOperationCallable()
Deletes an Index.
|
com.google.iam.v1.Policy |
getIamPolicy(com.google.iam.v1.GetIamPolicyRequest request)
Gets the access control policy for a resource.
|
com.google.api.gax.rpc.UnaryCallable<com.google.iam.v1.GetIamPolicyRequest,com.google.iam.v1.Policy> |
getIamPolicyCallable()
Gets the access control policy for a resource.
|
Index |
getIndex(GetIndexRequest request)
Gets an Index.
|
Index |
getIndex(IndexName name)
Gets an Index.
|
Index |
getIndex(String name)
Gets an Index.
|
com.google.api.gax.rpc.UnaryCallable<GetIndexRequest,Index> |
getIndexCallable()
Gets an Index.
|
com.google.cloud.location.Location |
getLocation(com.google.cloud.location.GetLocationRequest request)
Gets information about a location.
|
com.google.api.gax.rpc.UnaryCallable<com.google.cloud.location.GetLocationRequest,com.google.cloud.location.Location> |
getLocationCallable()
Gets information about a location.
|
com.google.longrunning.OperationsClient |
getOperationsClient()
Returns the OperationsClient that can be used to query the status of a long-running operation
returned by another API method call.
|
IndexServiceSettings |
getSettings() |
IndexServiceStub |
getStub() |
boolean |
isShutdown() |
boolean |
isTerminated() |
IndexServiceClient.ListIndexesPagedResponse |
listIndexes(ListIndexesRequest request)
Lists Indexes in a Location.
|
IndexServiceClient.ListIndexesPagedResponse |
listIndexes(LocationName parent)
Lists Indexes in a Location.
|
IndexServiceClient.ListIndexesPagedResponse |
listIndexes(String parent)
Lists Indexes in a Location.
|
com.google.api.gax.rpc.UnaryCallable<ListIndexesRequest,ListIndexesResponse> |
listIndexesCallable()
Lists Indexes in a Location.
|
com.google.api.gax.rpc.UnaryCallable<ListIndexesRequest,IndexServiceClient.ListIndexesPagedResponse> |
listIndexesPagedCallable()
Lists Indexes in a Location.
|
IndexServiceClient.ListLocationsPagedResponse |
listLocations(com.google.cloud.location.ListLocationsRequest request)
Lists information about the supported locations for this service.
|
com.google.api.gax.rpc.UnaryCallable<com.google.cloud.location.ListLocationsRequest,com.google.cloud.location.ListLocationsResponse> |
listLocationsCallable()
Lists information about the supported locations for this service.
|
com.google.api.gax.rpc.UnaryCallable<com.google.cloud.location.ListLocationsRequest,IndexServiceClient.ListLocationsPagedResponse> |
listLocationsPagedCallable()
Lists information about the supported locations for this service.
|
RemoveDatapointsResponse |
removeDatapoints(RemoveDatapointsRequest request)
Remove Datapoints from an Index.
|
com.google.api.gax.rpc.UnaryCallable<RemoveDatapointsRequest,RemoveDatapointsResponse> |
removeDatapointsCallable()
Remove Datapoints from an Index.
|
com.google.iam.v1.Policy |
setIamPolicy(com.google.iam.v1.SetIamPolicyRequest request)
Sets the access control policy on the specified resource.
|
com.google.api.gax.rpc.UnaryCallable<com.google.iam.v1.SetIamPolicyRequest,com.google.iam.v1.Policy> |
setIamPolicyCallable()
Sets the access control policy on the specified resource.
|
void |
shutdown() |
void |
shutdownNow() |
com.google.iam.v1.TestIamPermissionsResponse |
testIamPermissions(com.google.iam.v1.TestIamPermissionsRequest request)
Returns permissions that a caller has on the specified resource.
|
com.google.api.gax.rpc.UnaryCallable<com.google.iam.v1.TestIamPermissionsRequest,com.google.iam.v1.TestIamPermissionsResponse> |
testIamPermissionsCallable()
Returns permissions that a caller has on the specified resource.
|
com.google.api.gax.longrunning.OperationFuture<Index,UpdateIndexOperationMetadata> |
updateIndexAsync(Index index,
com.google.protobuf.FieldMask updateMask)
Updates an Index.
|
com.google.api.gax.longrunning.OperationFuture<Index,UpdateIndexOperationMetadata> |
updateIndexAsync(UpdateIndexRequest request)
Updates an Index.
|
com.google.api.gax.rpc.UnaryCallable<UpdateIndexRequest,com.google.longrunning.Operation> |
updateIndexCallable()
Updates an Index.
|
com.google.api.gax.rpc.OperationCallable<UpdateIndexRequest,Index,UpdateIndexOperationMetadata> |
updateIndexOperationCallable()
Updates an Index.
|
UpsertDatapointsResponse |
upsertDatapoints(UpsertDatapointsRequest request)
Add/update Datapoints into an Index.
|
com.google.api.gax.rpc.UnaryCallable<UpsertDatapointsRequest,UpsertDatapointsResponse> |
upsertDatapointsCallable()
Add/update Datapoints into an Index.
|
protected IndexServiceClient(IndexServiceSettings settings) throws IOException
IOExceptionprotected IndexServiceClient(IndexServiceStub stub)
public static final IndexServiceClient create() throws IOException
IOExceptionpublic static final IndexServiceClient create(IndexServiceSettings settings) throws IOException
IOExceptionpublic static final IndexServiceClient create(IndexServiceStub stub)
public final IndexServiceSettings getSettings()
public IndexServiceStub getStub()
public final com.google.longrunning.OperationsClient getOperationsClient()
public final com.google.api.gax.longrunning.OperationFuture<Index,CreateIndexOperationMetadata> createIndexAsync(LocationName parent, Index 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();
}
parent - Required. The resource name of the Location to create the Index in. Format:
`projects/{project}/locations/{location}`index - Required. The Index to create.com.google.api.gax.rpc.ApiException - if the remote call failspublic final com.google.api.gax.longrunning.OperationFuture<Index,CreateIndexOperationMetadata> createIndexAsync(String parent, Index 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();
}
parent - Required. The resource name of the Location to create the Index in. Format:
`projects/{project}/locations/{location}`index - Required. The Index to create.com.google.api.gax.rpc.ApiException - if the remote call failspublic final com.google.api.gax.longrunning.OperationFuture<Index,CreateIndexOperationMetadata> createIndexAsync(CreateIndexRequest request)
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();
}
request - The request object containing all of the parameters for the API call.com.google.api.gax.rpc.ApiException - if the remote call failspublic final com.google.api.gax.rpc.OperationCallable<CreateIndexRequest,Index,CreateIndexOperationMetadata> createIndexOperationCallable()
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();
}
public final com.google.api.gax.rpc.UnaryCallable<CreateIndexRequest,com.google.longrunning.Operation> createIndexCallable()
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();
}
public final Index getIndex(IndexName name)
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 - Required. The name of the Index resource. Format:
`projects/{project}/locations/{location}/indexes/{index}`com.google.api.gax.rpc.ApiException - if the remote call failspublic final Index getIndex(String name)
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 - Required. The name of the Index resource. Format:
`projects/{project}/locations/{location}/indexes/{index}`com.google.api.gax.rpc.ApiException - if the remote call failspublic final Index getIndex(GetIndexRequest request)
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);
}
request - The request object containing all of the parameters for the API call.com.google.api.gax.rpc.ApiException - if the remote call failspublic final com.google.api.gax.rpc.UnaryCallable<GetIndexRequest,Index> getIndexCallable()
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();
}
public final IndexServiceClient.ListIndexesPagedResponse listIndexes(LocationName parent)
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);
}
}
parent - Required. The resource name of the Location from which to list the Indexes.
Format: `projects/{project}/locations/{location}`com.google.api.gax.rpc.ApiException - if the remote call failspublic final IndexServiceClient.ListIndexesPagedResponse listIndexes(String parent)
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);
}
}
parent - Required. The resource name of the Location from which to list the Indexes.
Format: `projects/{project}/locations/{location}`com.google.api.gax.rpc.ApiException - if the remote call failspublic final IndexServiceClient.ListIndexesPagedResponse listIndexes(ListIndexesRequest request)
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);
}
}
request - The request object containing all of the parameters for the API call.com.google.api.gax.rpc.ApiException - if the remote call failspublic final com.google.api.gax.rpc.UnaryCallable<ListIndexesRequest,IndexServiceClient.ListIndexesPagedResponse> listIndexesPagedCallable()
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);
}
}
public final com.google.api.gax.rpc.UnaryCallable<ListIndexesRequest,ListIndexesResponse> listIndexesCallable()
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;
}
}
}
public final com.google.api.gax.longrunning.OperationFuture<Index,UpdateIndexOperationMetadata> updateIndexAsync(Index index, com.google.protobuf.FieldMask updateMask)
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();
}
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].com.google.api.gax.rpc.ApiException - if the remote call failspublic final com.google.api.gax.longrunning.OperationFuture<Index,UpdateIndexOperationMetadata> updateIndexAsync(UpdateIndexRequest request)
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();
}
request - The request object containing all of the parameters for the API call.com.google.api.gax.rpc.ApiException - if the remote call failspublic final com.google.api.gax.rpc.OperationCallable<UpdateIndexRequest,Index,UpdateIndexOperationMetadata> updateIndexOperationCallable()
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();
}
public final com.google.api.gax.rpc.UnaryCallable<UpdateIndexRequest,com.google.longrunning.Operation> updateIndexCallable()
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();
}
public final com.google.api.gax.longrunning.OperationFuture<com.google.protobuf.Empty,DeleteOperationMetadata> deleteIndexAsync(IndexName name)
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 - Required. The name of the Index resource to be deleted. Format:
`projects/{project}/locations/{location}/indexes/{index}`com.google.api.gax.rpc.ApiException - if the remote call failspublic final com.google.api.gax.longrunning.OperationFuture<com.google.protobuf.Empty,DeleteOperationMetadata> deleteIndexAsync(String name)
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 - Required. The name of the Index resource to be deleted. Format:
`projects/{project}/locations/{location}/indexes/{index}`com.google.api.gax.rpc.ApiException - if the remote call failspublic final com.google.api.gax.longrunning.OperationFuture<com.google.protobuf.Empty,DeleteOperationMetadata> deleteIndexAsync(DeleteIndexRequest request)
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();
}
request - The request object containing all of the parameters for the API call.com.google.api.gax.rpc.ApiException - if the remote call failspublic final com.google.api.gax.rpc.OperationCallable<DeleteIndexRequest,com.google.protobuf.Empty,DeleteOperationMetadata> deleteIndexOperationCallable()
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();
}
public final com.google.api.gax.rpc.UnaryCallable<DeleteIndexRequest,com.google.longrunning.Operation> deleteIndexCallable()
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();
}
public final UpsertDatapointsResponse upsertDatapoints(UpsertDatapointsRequest request)
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);
}
request - The request object containing all of the parameters for the API call.com.google.api.gax.rpc.ApiException - if the remote call failspublic final com.google.api.gax.rpc.UnaryCallable<UpsertDatapointsRequest,UpsertDatapointsResponse> upsertDatapointsCallable()
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();
}
public final RemoveDatapointsResponse removeDatapoints(RemoveDatapointsRequest request)
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);
}
request - The request object containing all of the parameters for the API call.com.google.api.gax.rpc.ApiException - if the remote call failspublic final com.google.api.gax.rpc.UnaryCallable<RemoveDatapointsRequest,RemoveDatapointsResponse> removeDatapointsCallable()
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();
}
public final IndexServiceClient.ListLocationsPagedResponse listLocations(com.google.cloud.location.ListLocationsRequest request)
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);
}
}
request - The request object containing all of the parameters for the API call.com.google.api.gax.rpc.ApiException - if the remote call failspublic final com.google.api.gax.rpc.UnaryCallable<com.google.cloud.location.ListLocationsRequest,IndexServiceClient.ListLocationsPagedResponse> listLocationsPagedCallable()
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);
}
}
public final com.google.api.gax.rpc.UnaryCallable<com.google.cloud.location.ListLocationsRequest,com.google.cloud.location.ListLocationsResponse> listLocationsCallable()
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;
}
}
}
public final com.google.cloud.location.Location getLocation(com.google.cloud.location.GetLocationRequest request)
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);
}
request - The request object containing all of the parameters for the API call.com.google.api.gax.rpc.ApiException - if the remote call failspublic final com.google.api.gax.rpc.UnaryCallable<com.google.cloud.location.GetLocationRequest,com.google.cloud.location.Location> getLocationCallable()
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();
}
public final com.google.iam.v1.Policy setIamPolicy(com.google.iam.v1.SetIamPolicyRequest request)
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);
}
request - The request object containing all of the parameters for the API call.com.google.api.gax.rpc.ApiException - if the remote call failspublic final com.google.api.gax.rpc.UnaryCallable<com.google.iam.v1.SetIamPolicyRequest,com.google.iam.v1.Policy> setIamPolicyCallable()
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();
}
public final com.google.iam.v1.Policy getIamPolicy(com.google.iam.v1.GetIamPolicyRequest request)
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);
}
request - The request object containing all of the parameters for the API call.com.google.api.gax.rpc.ApiException - if the remote call failspublic final com.google.api.gax.rpc.UnaryCallable<com.google.iam.v1.GetIamPolicyRequest,com.google.iam.v1.Policy> getIamPolicyCallable()
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();
}
public final com.google.iam.v1.TestIamPermissionsResponse testIamPermissions(com.google.iam.v1.TestIamPermissionsRequest request)
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);
}
request - The request object containing all of the parameters for the API call.com.google.api.gax.rpc.ApiException - if the remote call failspublic final com.google.api.gax.rpc.UnaryCallable<com.google.iam.v1.TestIamPermissionsRequest,com.google.iam.v1.TestIamPermissionsResponse> testIamPermissionsCallable()
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();
}
public final void close()
close in interface AutoCloseablepublic void shutdown()
shutdown in interface com.google.api.gax.core.BackgroundResourcepublic boolean isShutdown()
isShutdown in interface com.google.api.gax.core.BackgroundResourcepublic boolean isTerminated()
isTerminated in interface com.google.api.gax.core.BackgroundResourcepublic void shutdownNow()
shutdownNow in interface com.google.api.gax.core.BackgroundResourcepublic boolean awaitTermination(long duration,
TimeUnit unit)
throws InterruptedException
awaitTermination in interface com.google.api.gax.core.BackgroundResourceInterruptedExceptionCopyright © 2023 Google LLC. All rights reserved.