@BetaApi @Generated(value="by gapic-generator-java") public class DataStoreServiceClient 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 (DataStoreServiceClient dataStoreServiceClient = DataStoreServiceClient.create()) {
DataStoreName name =
DataStoreName.ofProjectLocationDataStoreName("[PROJECT]", "[LOCATION]", "[DATA_STORE]");
DataStore response = dataStoreServiceClient.getDataStore(name);
}
Note: close() needs to be called on the DataStoreServiceClient object to clean up resources such as threads. In the example above, try-with-resources is used, which automatically calls close().
| Method | Description | Method Variants |
|---|---|---|
CreateDataStore |
Creates a [DataStore][google.cloud.discoveryengine.v1beta.DataStore]. DataStore is for storing [Documents][google.cloud.discoveryengine.v1beta.Document]. To serve these documents for Search, or Recommendation use case, an [Engine][google.cloud.discoveryengine.v1beta.Engine] needs to be created separately. |
Request object method variants only take one parameter, a request object, which must be constructed before the call.
Methods that return long-running operations have "Async" method variants that return `OperationFuture`, which is used to track polling of the service.
Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.
|
GetDataStore |
Gets a [DataStore][google.cloud.discoveryengine.v1beta.DataStore]. |
Request object method variants only take one parameter, a request object, which must be constructed before the call.
"Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method.
Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.
|
ListDataStores |
Lists all the [DataStore][google.cloud.discoveryengine.v1beta.DataStore]s associated with the project. |
Request object method variants only take one parameter, a request object, which must be constructed before the call.
"Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method.
Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.
|
DeleteDataStore |
Deletes a [DataStore][google.cloud.discoveryengine.v1beta.DataStore]. |
Request object method variants only take one parameter, a request object, which must be constructed before the call.
Methods that return long-running operations have "Async" method variants that return `OperationFuture`, which is used to track polling of the service.
Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.
|
UpdateDataStore |
Updates a [DataStore][google.cloud.discoveryengine.v1beta.DataStore] |
Request object method variants only take one parameter, a request object, which must be constructed before the call.
"Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method.
Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.
|
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 DataStoreServiceSettings 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
DataStoreServiceSettings dataStoreServiceSettings =
DataStoreServiceSettings.newBuilder()
.setCredentialsProvider(FixedCredentialsProvider.create(myCredentials))
.build();
DataStoreServiceClient dataStoreServiceClient =
DataStoreServiceClient.create(dataStoreServiceSettings);
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
DataStoreServiceSettings dataStoreServiceSettings =
DataStoreServiceSettings.newBuilder().setEndpoint(myEndpoint).build();
DataStoreServiceClient dataStoreServiceClient =
DataStoreServiceClient.create(dataStoreServiceSettings);
To use REST (HTTP1.1/JSON) transport (instead of gRPC) for sending and receiving requests over the wire:
// 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
DataStoreServiceSettings dataStoreServiceSettings =
DataStoreServiceSettings.newHttpJsonBuilder().build();
DataStoreServiceClient dataStoreServiceClient =
DataStoreServiceClient.create(dataStoreServiceSettings);
Please refer to the GitHub repository's samples for more quickstart code snippets.
| Modifier and Type | Class and Description |
|---|---|
static class |
DataStoreServiceClient.ListDataStoresFixedSizeCollection |
static class |
DataStoreServiceClient.ListDataStoresPage |
static class |
DataStoreServiceClient.ListDataStoresPagedResponse |
| Modifier | Constructor and Description |
|---|---|
protected |
DataStoreServiceClient(DataStoreServiceSettings settings)
Constructs an instance of DataStoreServiceClient, using the given settings.
|
protected |
DataStoreServiceClient(DataStoreServiceStub stub) |
| Modifier and Type | Method and Description |
|---|---|
boolean |
awaitTermination(long duration,
TimeUnit unit) |
void |
close() |
static DataStoreServiceClient |
create()
Constructs an instance of DataStoreServiceClient with default settings.
|
static DataStoreServiceClient |
create(DataStoreServiceSettings settings)
Constructs an instance of DataStoreServiceClient, using the given settings.
|
static DataStoreServiceClient |
create(DataStoreServiceStub stub)
Constructs an instance of DataStoreServiceClient, using the given stub for making calls.
|
com.google.api.gax.longrunning.OperationFuture<DataStore,CreateDataStoreMetadata> |
createDataStoreAsync(CollectionName parent,
DataStore dataStore,
String dataStoreId)
Creates a [DataStore][google.cloud.discoveryengine.v1beta.DataStore].
|
com.google.api.gax.longrunning.OperationFuture<DataStore,CreateDataStoreMetadata> |
createDataStoreAsync(CreateDataStoreRequest request)
Creates a [DataStore][google.cloud.discoveryengine.v1beta.DataStore].
|
com.google.api.gax.longrunning.OperationFuture<DataStore,CreateDataStoreMetadata> |
createDataStoreAsync(String parent,
DataStore dataStore,
String dataStoreId)
Creates a [DataStore][google.cloud.discoveryengine.v1beta.DataStore].
|
com.google.api.gax.rpc.UnaryCallable<CreateDataStoreRequest,com.google.longrunning.Operation> |
createDataStoreCallable()
Creates a [DataStore][google.cloud.discoveryengine.v1beta.DataStore].
|
com.google.api.gax.rpc.OperationCallable<CreateDataStoreRequest,DataStore,CreateDataStoreMetadata> |
createDataStoreOperationCallable()
Creates a [DataStore][google.cloud.discoveryengine.v1beta.DataStore].
|
com.google.api.gax.longrunning.OperationFuture<com.google.protobuf.Empty,DeleteDataStoreMetadata> |
deleteDataStoreAsync(DataStoreName name)
Deletes a [DataStore][google.cloud.discoveryengine.v1beta.DataStore].
|
com.google.api.gax.longrunning.OperationFuture<com.google.protobuf.Empty,DeleteDataStoreMetadata> |
deleteDataStoreAsync(DeleteDataStoreRequest request)
Deletes a [DataStore][google.cloud.discoveryengine.v1beta.DataStore].
|
com.google.api.gax.longrunning.OperationFuture<com.google.protobuf.Empty,DeleteDataStoreMetadata> |
deleteDataStoreAsync(String name)
Deletes a [DataStore][google.cloud.discoveryengine.v1beta.DataStore].
|
com.google.api.gax.rpc.UnaryCallable<DeleteDataStoreRequest,com.google.longrunning.Operation> |
deleteDataStoreCallable()
Deletes a [DataStore][google.cloud.discoveryengine.v1beta.DataStore].
|
com.google.api.gax.rpc.OperationCallable<DeleteDataStoreRequest,com.google.protobuf.Empty,DeleteDataStoreMetadata> |
deleteDataStoreOperationCallable()
Deletes a [DataStore][google.cloud.discoveryengine.v1beta.DataStore].
|
DataStore |
getDataStore(DataStoreName name)
Gets a [DataStore][google.cloud.discoveryengine.v1beta.DataStore].
|
DataStore |
getDataStore(GetDataStoreRequest request)
Gets a [DataStore][google.cloud.discoveryengine.v1beta.DataStore].
|
DataStore |
getDataStore(String name)
Gets a [DataStore][google.cloud.discoveryengine.v1beta.DataStore].
|
com.google.api.gax.rpc.UnaryCallable<GetDataStoreRequest,DataStore> |
getDataStoreCallable()
Gets a [DataStore][google.cloud.discoveryengine.v1beta.DataStore].
|
com.google.api.gax.httpjson.longrunning.OperationsClient |
getHttpJsonOperationsClient()
Returns the OperationsClient that can be used to query the status of a long-running operation
returned by another API method call.
|
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.
|
DataStoreServiceSettings |
getSettings() |
DataStoreServiceStub |
getStub() |
boolean |
isShutdown() |
boolean |
isTerminated() |
DataStoreServiceClient.ListDataStoresPagedResponse |
listDataStores(CollectionName parent)
Lists all the [DataStore][google.cloud.discoveryengine.v1beta.DataStore]s associated with the
project.
|
DataStoreServiceClient.ListDataStoresPagedResponse |
listDataStores(ListDataStoresRequest request)
Lists all the [DataStore][google.cloud.discoveryengine.v1beta.DataStore]s associated with the
project.
|
DataStoreServiceClient.ListDataStoresPagedResponse |
listDataStores(String parent)
Lists all the [DataStore][google.cloud.discoveryengine.v1beta.DataStore]s associated with the
project.
|
com.google.api.gax.rpc.UnaryCallable<ListDataStoresRequest,ListDataStoresResponse> |
listDataStoresCallable()
Lists all the [DataStore][google.cloud.discoveryengine.v1beta.DataStore]s associated with the
project.
|
com.google.api.gax.rpc.UnaryCallable<ListDataStoresRequest,DataStoreServiceClient.ListDataStoresPagedResponse> |
listDataStoresPagedCallable()
Lists all the [DataStore][google.cloud.discoveryengine.v1beta.DataStore]s associated with the
project.
|
void |
shutdown() |
void |
shutdownNow() |
DataStore |
updateDataStore(DataStore dataStore,
com.google.protobuf.FieldMask updateMask)
Updates a [DataStore][google.cloud.discoveryengine.v1beta.DataStore]
|
DataStore |
updateDataStore(UpdateDataStoreRequest request)
Updates a [DataStore][google.cloud.discoveryengine.v1beta.DataStore]
|
com.google.api.gax.rpc.UnaryCallable<UpdateDataStoreRequest,DataStore> |
updateDataStoreCallable()
Updates a [DataStore][google.cloud.discoveryengine.v1beta.DataStore]
|
protected DataStoreServiceClient(DataStoreServiceSettings settings) throws IOException
IOExceptionprotected DataStoreServiceClient(DataStoreServiceStub stub)
public static final DataStoreServiceClient create() throws IOException
IOExceptionpublic static final DataStoreServiceClient create(DataStoreServiceSettings settings) throws IOException
IOExceptionpublic static final DataStoreServiceClient create(DataStoreServiceStub stub)
public final DataStoreServiceSettings getSettings()
public DataStoreServiceStub getStub()
public final com.google.longrunning.OperationsClient getOperationsClient()
@BetaApi public final com.google.api.gax.httpjson.longrunning.OperationsClient getHttpJsonOperationsClient()
public final com.google.api.gax.longrunning.OperationFuture<DataStore,CreateDataStoreMetadata> createDataStoreAsync(CollectionName parent, DataStore dataStore, String dataStoreId)
DataStore is for storing [Documents][google.cloud.discoveryengine.v1beta.Document]. To serve these documents for Search, or Recommendation use case, an [Engine][google.cloud.discoveryengine.v1beta.Engine] needs to be created separately.
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 (DataStoreServiceClient dataStoreServiceClient = DataStoreServiceClient.create()) {
CollectionName parent = CollectionName.of("[PROJECT]", "[LOCATION]", "[COLLECTION]");
DataStore dataStore = DataStore.newBuilder().build();
String dataStoreId = "dataStoreId929489618";
DataStore response =
dataStoreServiceClient.createDataStoreAsync(parent, dataStore, dataStoreId).get();
}
parent - Required. The parent resource name, such as
`projects/{project}/locations/{location}/collections/{collection}`.dataStore - Required. The [DataStore][google.cloud.discoveryengine.v1beta.DataStore] to
create.dataStoreId - Required. The ID to use for the
[DataStore][google.cloud.discoveryengine.v1beta.DataStore], which will become the final
component of the [DataStore][google.cloud.discoveryengine.v1beta.DataStore]'s resource
name.
This field must conform to [RFC-1034](https://tools.ietf.org/html/rfc1034) standard with a length limit of 63 characters. Otherwise, an INVALID_ARGUMENT error is returned.
com.google.api.gax.rpc.ApiException - if the remote call failspublic final com.google.api.gax.longrunning.OperationFuture<DataStore,CreateDataStoreMetadata> createDataStoreAsync(String parent, DataStore dataStore, String dataStoreId)
DataStore is for storing [Documents][google.cloud.discoveryengine.v1beta.Document]. To serve these documents for Search, or Recommendation use case, an [Engine][google.cloud.discoveryengine.v1beta.Engine] needs to be created separately.
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 (DataStoreServiceClient dataStoreServiceClient = DataStoreServiceClient.create()) {
String parent = CollectionName.of("[PROJECT]", "[LOCATION]", "[COLLECTION]").toString();
DataStore dataStore = DataStore.newBuilder().build();
String dataStoreId = "dataStoreId929489618";
DataStore response =
dataStoreServiceClient.createDataStoreAsync(parent, dataStore, dataStoreId).get();
}
parent - Required. The parent resource name, such as
`projects/{project}/locations/{location}/collections/{collection}`.dataStore - Required. The [DataStore][google.cloud.discoveryengine.v1beta.DataStore] to
create.dataStoreId - Required. The ID to use for the
[DataStore][google.cloud.discoveryengine.v1beta.DataStore], which will become the final
component of the [DataStore][google.cloud.discoveryengine.v1beta.DataStore]'s resource
name.
This field must conform to [RFC-1034](https://tools.ietf.org/html/rfc1034) standard with a length limit of 63 characters. Otherwise, an INVALID_ARGUMENT error is returned.
com.google.api.gax.rpc.ApiException - if the remote call failspublic final com.google.api.gax.longrunning.OperationFuture<DataStore,CreateDataStoreMetadata> createDataStoreAsync(CreateDataStoreRequest request)
DataStore is for storing [Documents][google.cloud.discoveryengine.v1beta.Document]. To serve these documents for Search, or Recommendation use case, an [Engine][google.cloud.discoveryengine.v1beta.Engine] needs to be created separately.
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 (DataStoreServiceClient dataStoreServiceClient = DataStoreServiceClient.create()) {
CreateDataStoreRequest request =
CreateDataStoreRequest.newBuilder()
.setParent(CollectionName.of("[PROJECT]", "[LOCATION]", "[COLLECTION]").toString())
.setDataStore(DataStore.newBuilder().build())
.setDataStoreId("dataStoreId929489618")
.setCreateAdvancedSiteSearch(true)
.build();
DataStore response = dataStoreServiceClient.createDataStoreAsync(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<CreateDataStoreRequest,DataStore,CreateDataStoreMetadata> createDataStoreOperationCallable()
DataStore is for storing [Documents][google.cloud.discoveryengine.v1beta.Document]. To serve these documents for Search, or Recommendation use case, an [Engine][google.cloud.discoveryengine.v1beta.Engine] needs to be created separately.
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 (DataStoreServiceClient dataStoreServiceClient = DataStoreServiceClient.create()) {
CreateDataStoreRequest request =
CreateDataStoreRequest.newBuilder()
.setParent(CollectionName.of("[PROJECT]", "[LOCATION]", "[COLLECTION]").toString())
.setDataStore(DataStore.newBuilder().build())
.setDataStoreId("dataStoreId929489618")
.setCreateAdvancedSiteSearch(true)
.build();
OperationFuture<DataStore, CreateDataStoreMetadata> future =
dataStoreServiceClient.createDataStoreOperationCallable().futureCall(request);
// Do something.
DataStore response = future.get();
}
public final com.google.api.gax.rpc.UnaryCallable<CreateDataStoreRequest,com.google.longrunning.Operation> createDataStoreCallable()
DataStore is for storing [Documents][google.cloud.discoveryengine.v1beta.Document]. To serve these documents for Search, or Recommendation use case, an [Engine][google.cloud.discoveryengine.v1beta.Engine] needs to be created separately.
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 (DataStoreServiceClient dataStoreServiceClient = DataStoreServiceClient.create()) {
CreateDataStoreRequest request =
CreateDataStoreRequest.newBuilder()
.setParent(CollectionName.of("[PROJECT]", "[LOCATION]", "[COLLECTION]").toString())
.setDataStore(DataStore.newBuilder().build())
.setDataStoreId("dataStoreId929489618")
.setCreateAdvancedSiteSearch(true)
.build();
ApiFuture<Operation> future =
dataStoreServiceClient.createDataStoreCallable().futureCall(request);
// Do something.
Operation response = future.get();
}
public final DataStore getDataStore(DataStoreName 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 (DataStoreServiceClient dataStoreServiceClient = DataStoreServiceClient.create()) {
DataStoreName name =
DataStoreName.ofProjectLocationDataStoreName("[PROJECT]", "[LOCATION]", "[DATA_STORE]");
DataStore response = dataStoreServiceClient.getDataStore(name);
}
name - Required. Full resource name of
[DataStore][google.cloud.discoveryengine.v1beta.DataStore], such as
`projects/{project}/locations/{location}/collections/{collection_id}/dataStores/{data_store_id}`.
If the caller does not have permission to access the [DataStore][google.cloud.discoveryengine.v1beta.DataStore], regardless of whether or not it exists, a PERMISSION_DENIED error is returned.
If the requested [DataStore][google.cloud.discoveryengine.v1beta.DataStore] does not exist, a NOT_FOUND error is returned.
com.google.api.gax.rpc.ApiException - if the remote call failspublic final DataStore getDataStore(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 (DataStoreServiceClient dataStoreServiceClient = DataStoreServiceClient.create()) {
String name =
DataStoreName.ofProjectLocationDataStoreName("[PROJECT]", "[LOCATION]", "[DATA_STORE]")
.toString();
DataStore response = dataStoreServiceClient.getDataStore(name);
}
name - Required. Full resource name of
[DataStore][google.cloud.discoveryengine.v1beta.DataStore], such as
`projects/{project}/locations/{location}/collections/{collection_id}/dataStores/{data_store_id}`.
If the caller does not have permission to access the [DataStore][google.cloud.discoveryengine.v1beta.DataStore], regardless of whether or not it exists, a PERMISSION_DENIED error is returned.
If the requested [DataStore][google.cloud.discoveryengine.v1beta.DataStore] does not exist, a NOT_FOUND error is returned.
com.google.api.gax.rpc.ApiException - if the remote call failspublic final DataStore getDataStore(GetDataStoreRequest 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 (DataStoreServiceClient dataStoreServiceClient = DataStoreServiceClient.create()) {
GetDataStoreRequest request =
GetDataStoreRequest.newBuilder()
.setName(
DataStoreName.ofProjectLocationDataStoreName(
"[PROJECT]", "[LOCATION]", "[DATA_STORE]")
.toString())
.build();
DataStore response = dataStoreServiceClient.getDataStore(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<GetDataStoreRequest,DataStore> getDataStoreCallable()
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 (DataStoreServiceClient dataStoreServiceClient = DataStoreServiceClient.create()) {
GetDataStoreRequest request =
GetDataStoreRequest.newBuilder()
.setName(
DataStoreName.ofProjectLocationDataStoreName(
"[PROJECT]", "[LOCATION]", "[DATA_STORE]")
.toString())
.build();
ApiFuture<DataStore> future =
dataStoreServiceClient.getDataStoreCallable().futureCall(request);
// Do something.
DataStore response = future.get();
}
public final DataStoreServiceClient.ListDataStoresPagedResponse listDataStores(CollectionName 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 (DataStoreServiceClient dataStoreServiceClient = DataStoreServiceClient.create()) {
CollectionName parent = CollectionName.of("[PROJECT]", "[LOCATION]", "[COLLECTION]");
for (DataStore element : dataStoreServiceClient.listDataStores(parent).iterateAll()) {
// doThingsWith(element);
}
}
parent - Required. The parent branch resource name, such as
`projects/{project}/locations/{location}/collections/{collection_id}`.
If the caller does not have permission to list [DataStore][google.cloud.discoveryengine.v1beta.DataStore]s under this location, regardless of whether or not this data store exists, a PERMISSION_DENIED error is returned.
com.google.api.gax.rpc.ApiException - if the remote call failspublic final DataStoreServiceClient.ListDataStoresPagedResponse listDataStores(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 (DataStoreServiceClient dataStoreServiceClient = DataStoreServiceClient.create()) {
String parent = CollectionName.of("[PROJECT]", "[LOCATION]", "[COLLECTION]").toString();
for (DataStore element : dataStoreServiceClient.listDataStores(parent).iterateAll()) {
// doThingsWith(element);
}
}
parent - Required. The parent branch resource name, such as
`projects/{project}/locations/{location}/collections/{collection_id}`.
If the caller does not have permission to list [DataStore][google.cloud.discoveryengine.v1beta.DataStore]s under this location, regardless of whether or not this data store exists, a PERMISSION_DENIED error is returned.
com.google.api.gax.rpc.ApiException - if the remote call failspublic final DataStoreServiceClient.ListDataStoresPagedResponse listDataStores(ListDataStoresRequest 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 (DataStoreServiceClient dataStoreServiceClient = DataStoreServiceClient.create()) {
ListDataStoresRequest request =
ListDataStoresRequest.newBuilder()
.setParent(CollectionName.of("[PROJECT]", "[LOCATION]", "[COLLECTION]").toString())
.setPageSize(883849137)
.setPageToken("pageToken873572522")
.setFilter("filter-1274492040")
.build();
for (DataStore element : dataStoreServiceClient.listDataStores(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<ListDataStoresRequest,DataStoreServiceClient.ListDataStoresPagedResponse> listDataStoresPagedCallable()
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 (DataStoreServiceClient dataStoreServiceClient = DataStoreServiceClient.create()) {
ListDataStoresRequest request =
ListDataStoresRequest.newBuilder()
.setParent(CollectionName.of("[PROJECT]", "[LOCATION]", "[COLLECTION]").toString())
.setPageSize(883849137)
.setPageToken("pageToken873572522")
.setFilter("filter-1274492040")
.build();
ApiFuture<DataStore> future =
dataStoreServiceClient.listDataStoresPagedCallable().futureCall(request);
// Do something.
for (DataStore element : future.get().iterateAll()) {
// doThingsWith(element);
}
}
public final com.google.api.gax.rpc.UnaryCallable<ListDataStoresRequest,ListDataStoresResponse> listDataStoresCallable()
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 (DataStoreServiceClient dataStoreServiceClient = DataStoreServiceClient.create()) {
ListDataStoresRequest request =
ListDataStoresRequest.newBuilder()
.setParent(CollectionName.of("[PROJECT]", "[LOCATION]", "[COLLECTION]").toString())
.setPageSize(883849137)
.setPageToken("pageToken873572522")
.setFilter("filter-1274492040")
.build();
while (true) {
ListDataStoresResponse response =
dataStoreServiceClient.listDataStoresCallable().call(request);
for (DataStore element : response.getDataStoresList()) {
// 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<com.google.protobuf.Empty,DeleteDataStoreMetadata> deleteDataStoreAsync(DataStoreName 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 (DataStoreServiceClient dataStoreServiceClient = DataStoreServiceClient.create()) {
DataStoreName name =
DataStoreName.ofProjectLocationDataStoreName("[PROJECT]", "[LOCATION]", "[DATA_STORE]");
dataStoreServiceClient.deleteDataStoreAsync(name).get();
}
name - Required. Full resource name of
[DataStore][google.cloud.discoveryengine.v1beta.DataStore], such as
`projects/{project}/locations/{location}/collections/{collection_id}/dataStores/{data_store_id}`.
If the caller does not have permission to delete the [DataStore][google.cloud.discoveryengine.v1beta.DataStore], regardless of whether or not it exists, a PERMISSION_DENIED error is returned.
If the [DataStore][google.cloud.discoveryengine.v1beta.DataStore] to delete does not exist, a NOT_FOUND error is returned.
com.google.api.gax.rpc.ApiException - if the remote call failspublic final com.google.api.gax.longrunning.OperationFuture<com.google.protobuf.Empty,DeleteDataStoreMetadata> deleteDataStoreAsync(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 (DataStoreServiceClient dataStoreServiceClient = DataStoreServiceClient.create()) {
String name =
DataStoreName.ofProjectLocationDataStoreName("[PROJECT]", "[LOCATION]", "[DATA_STORE]")
.toString();
dataStoreServiceClient.deleteDataStoreAsync(name).get();
}
name - Required. Full resource name of
[DataStore][google.cloud.discoveryengine.v1beta.DataStore], such as
`projects/{project}/locations/{location}/collections/{collection_id}/dataStores/{data_store_id}`.
If the caller does not have permission to delete the [DataStore][google.cloud.discoveryengine.v1beta.DataStore], regardless of whether or not it exists, a PERMISSION_DENIED error is returned.
If the [DataStore][google.cloud.discoveryengine.v1beta.DataStore] to delete does not exist, a NOT_FOUND error is returned.
com.google.api.gax.rpc.ApiException - if the remote call failspublic final com.google.api.gax.longrunning.OperationFuture<com.google.protobuf.Empty,DeleteDataStoreMetadata> deleteDataStoreAsync(DeleteDataStoreRequest 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 (DataStoreServiceClient dataStoreServiceClient = DataStoreServiceClient.create()) {
DeleteDataStoreRequest request =
DeleteDataStoreRequest.newBuilder()
.setName(
DataStoreName.ofProjectLocationDataStoreName(
"[PROJECT]", "[LOCATION]", "[DATA_STORE]")
.toString())
.build();
dataStoreServiceClient.deleteDataStoreAsync(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<DeleteDataStoreRequest,com.google.protobuf.Empty,DeleteDataStoreMetadata> deleteDataStoreOperationCallable()
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 (DataStoreServiceClient dataStoreServiceClient = DataStoreServiceClient.create()) {
DeleteDataStoreRequest request =
DeleteDataStoreRequest.newBuilder()
.setName(
DataStoreName.ofProjectLocationDataStoreName(
"[PROJECT]", "[LOCATION]", "[DATA_STORE]")
.toString())
.build();
OperationFuture<Empty, DeleteDataStoreMetadata> future =
dataStoreServiceClient.deleteDataStoreOperationCallable().futureCall(request);
// Do something.
future.get();
}
public final com.google.api.gax.rpc.UnaryCallable<DeleteDataStoreRequest,com.google.longrunning.Operation> deleteDataStoreCallable()
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 (DataStoreServiceClient dataStoreServiceClient = DataStoreServiceClient.create()) {
DeleteDataStoreRequest request =
DeleteDataStoreRequest.newBuilder()
.setName(
DataStoreName.ofProjectLocationDataStoreName(
"[PROJECT]", "[LOCATION]", "[DATA_STORE]")
.toString())
.build();
ApiFuture<Operation> future =
dataStoreServiceClient.deleteDataStoreCallable().futureCall(request);
// Do something.
future.get();
}
public final DataStore updateDataStore(DataStore dataStore, 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 (DataStoreServiceClient dataStoreServiceClient = DataStoreServiceClient.create()) {
DataStore dataStore = DataStore.newBuilder().build();
FieldMask updateMask = FieldMask.newBuilder().build();
DataStore response = dataStoreServiceClient.updateDataStore(dataStore, updateMask);
}
dataStore - Required. The [DataStore][google.cloud.discoveryengine.v1beta.DataStore] to
update.
If the caller does not have permission to update the [DataStore][google.cloud.discoveryengine.v1beta.DataStore], regardless of whether or not it exists, a PERMISSION_DENIED error is returned.
If the [DataStore][google.cloud.discoveryengine.v1beta.DataStore] to update does not exist, a NOT_FOUND error is returned.
updateMask - Indicates which fields in the provided
[DataStore][google.cloud.discoveryengine.v1beta.DataStore] to update.
If an unsupported or unknown field is provided, an INVALID_ARGUMENT error is returned.
com.google.api.gax.rpc.ApiException - if the remote call failspublic final DataStore updateDataStore(UpdateDataStoreRequest 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 (DataStoreServiceClient dataStoreServiceClient = DataStoreServiceClient.create()) {
UpdateDataStoreRequest request =
UpdateDataStoreRequest.newBuilder()
.setDataStore(DataStore.newBuilder().build())
.setUpdateMask(FieldMask.newBuilder().build())
.build();
DataStore response = dataStoreServiceClient.updateDataStore(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<UpdateDataStoreRequest,DataStore> updateDataStoreCallable()
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 (DataStoreServiceClient dataStoreServiceClient = DataStoreServiceClient.create()) {
UpdateDataStoreRequest request =
UpdateDataStoreRequest.newBuilder()
.setDataStore(DataStore.newBuilder().build())
.setUpdateMask(FieldMask.newBuilder().build())
.build();
ApiFuture<DataStore> future =
dataStoreServiceClient.updateDataStoreCallable().futureCall(request);
// Do something.
DataStore 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 © 2024 Google LLC. All rights reserved.