| GitHub Repository | Product Reference |
Service Description: Service for data connector management.
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 (DataConnectorServiceClient dataConnectorServiceClient =
DataConnectorServiceClient.create()) {
DataConnectorName name = DataConnectorName.of("[PROJECT]", "[LOCATION]", "[COLLECTION]");
DataConnector response = dataConnectorServiceClient.getDataConnector(name);
}
Note: close() needs to be called on the DataConnectorServiceClient 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 |
|---|---|---|
SetUpDataConnector |
Creates a Collection and sets up the DataConnector for it. To stop a DataConnector after setup, use the CollectionService.DeleteCollection method. |
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
Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.
|
GetDataConnector |
Gets the DataConnector. DataConnector is a singleton resource for each Collection. |
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.
|
UpdateDataConnector |
Updates a DataConnector. |
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 DataConnectorServiceSettings 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
DataConnectorServiceSettings dataConnectorServiceSettings =
DataConnectorServiceSettings.newBuilder()
.setCredentialsProvider(FixedCredentialsProvider.create(myCredentials))
.build();
DataConnectorServiceClient dataConnectorServiceClient =
DataConnectorServiceClient.create(dataConnectorServiceSettings);
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
DataConnectorServiceSettings dataConnectorServiceSettings =
DataConnectorServiceSettings.newBuilder().setEndpoint(myEndpoint).build();
DataConnectorServiceClient dataConnectorServiceClient =
DataConnectorServiceClient.create(dataConnectorServiceSettings);
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
DataConnectorServiceSettings dataConnectorServiceSettings =
DataConnectorServiceSettings.newHttpJsonBuilder().build();
DataConnectorServiceClient dataConnectorServiceClient =
DataConnectorServiceClient.create(dataConnectorServiceSettings);
Please refer to the GitHub repository's samples for more quickstart code snippets.
Static Methods
create()
public static final DataConnectorServiceClient create()Constructs an instance of DataConnectorServiceClient with default settings.
| Returns | |
|---|---|
| Type | Description |
DataConnectorServiceClient |
|
| Exceptions | |
|---|---|
| Type | Description |
IOException |
|
create(DataConnectorServiceSettings settings)
public static final DataConnectorServiceClient create(DataConnectorServiceSettings settings)Constructs an instance of DataConnectorServiceClient, using the given settings. The channels are created based on the settings passed in, or defaults for any settings that are not set.
| Parameter | |
|---|---|
| Name | Description |
settings |
DataConnectorServiceSettings |
| Returns | |
|---|---|
| Type | Description |
DataConnectorServiceClient |
|
| Exceptions | |
|---|---|
| Type | Description |
IOException |
|
create(DataConnectorServiceStub stub)
public static final DataConnectorServiceClient create(DataConnectorServiceStub stub)Constructs an instance of DataConnectorServiceClient, using the given stub for making calls. This is for advanced usage - prefer using create(DataConnectorServiceSettings).
| Parameter | |
|---|---|
| Name | Description |
stub |
DataConnectorServiceStub |
| Returns | |
|---|---|
| Type | Description |
DataConnectorServiceClient |
|
Constructors
DataConnectorServiceClient(DataConnectorServiceSettings settings)
protected DataConnectorServiceClient(DataConnectorServiceSettings settings)Constructs an instance of DataConnectorServiceClient, 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.
| Parameter | |
|---|---|
| Name | Description |
settings |
DataConnectorServiceSettings |
DataConnectorServiceClient(DataConnectorServiceStub stub)
protected DataConnectorServiceClient(DataConnectorServiceStub stub)| Parameter | |
|---|---|
| Name | Description |
stub |
DataConnectorServiceStub |
Methods
awaitTermination(long duration, TimeUnit unit)
public boolean awaitTermination(long duration, TimeUnit unit)| Parameters | |
|---|---|
| Name | Description |
duration |
long |
unit |
TimeUnit |
| Returns | |
|---|---|
| Type | Description |
boolean |
|
| Exceptions | |
|---|---|
| Type | Description |
InterruptedException |
|
close()
public final void close()getDataConnector(@Nullable DataConnectorName name)
public final DataConnector getDataConnector(@Nullable DataConnectorName name)Gets the DataConnector. DataConnector is a singleton resource for each Collection.
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 (DataConnectorServiceClient dataConnectorServiceClient =
DataConnectorServiceClient.create()) {
DataConnectorName name = DataConnectorName.of("[PROJECT]", "[LOCATION]", "[COLLECTION]");
DataConnector response = dataConnectorServiceClient.getDataConnector(name);
}
| Parameter | |
|---|---|
| Name | Description |
name |
@org.jspecify.annotations.Nullable com.google.cloud.discoveryengine.v1.DataConnectorNameRequired. Full resource name of
DataConnector, such as
If the caller does not have permission to access the
DataConnector, regardless of whether or
not it exists, a If the requested DataConnector does not
exist, a |
| Returns | |
|---|---|
| Type | Description |
DataConnector |
|
getDataConnector(GetDataConnectorRequest request)
public final DataConnector getDataConnector(GetDataConnectorRequest request)Gets the DataConnector. DataConnector is a singleton resource for each Collection.
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 (DataConnectorServiceClient dataConnectorServiceClient =
DataConnectorServiceClient.create()) {
GetDataConnectorRequest request =
GetDataConnectorRequest.newBuilder()
.setName(DataConnectorName.of("[PROJECT]", "[LOCATION]", "[COLLECTION]").toString())
.build();
DataConnector response = dataConnectorServiceClient.getDataConnector(request);
}
| Parameter | |
|---|---|
| Name | Description |
request |
GetDataConnectorRequestThe request object containing all of the parameters for the API call. |
| Returns | |
|---|---|
| Type | Description |
DataConnector |
|
getDataConnector(String name)
public final DataConnector getDataConnector(String name)Gets the DataConnector. DataConnector is a singleton resource for each Collection.
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 (DataConnectorServiceClient dataConnectorServiceClient =
DataConnectorServiceClient.create()) {
String name = DataConnectorName.of("[PROJECT]", "[LOCATION]", "[COLLECTION]").toString();
DataConnector response = dataConnectorServiceClient.getDataConnector(name);
}
| Parameter | |
|---|---|
| Name | Description |
name |
StringRequired. Full resource name of
DataConnector, such as
If the caller does not have permission to access the
DataConnector, regardless of whether or
not it exists, a If the requested DataConnector does not
exist, a |
| Returns | |
|---|---|
| Type | Description |
DataConnector |
|
getDataConnectorCallable()
public final UnaryCallable<GetDataConnectorRequest,DataConnector> getDataConnectorCallable()Gets the DataConnector. DataConnector is a singleton resource for each Collection.
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 (DataConnectorServiceClient dataConnectorServiceClient =
DataConnectorServiceClient.create()) {
GetDataConnectorRequest request =
GetDataConnectorRequest.newBuilder()
.setName(DataConnectorName.of("[PROJECT]", "[LOCATION]", "[COLLECTION]").toString())
.build();
ApiFuture<DataConnector> future =
dataConnectorServiceClient.getDataConnectorCallable().futureCall(request);
// Do something.
DataConnector response = future.get();
}
| Returns | |
|---|---|
| Type | Description |
UnaryCallable<GetDataConnectorRequest,DataConnector> |
|
getHttpJsonOperationsClient()
public final OperationsClient getHttpJsonOperationsClient()Returns the OperationsClient that can be used to query the status of a long-running operation returned by another API method call.
| Returns | |
|---|---|
| Type | Description |
OperationsClient |
|
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.
| Returns | |
|---|---|
| Type | Description |
OperationsClient |
|
getSettings()
public final @Nullable DataConnectorServiceSettings getSettings()| Returns | |
|---|---|
| Type | Description |
@org.jspecify.annotations.Nullable com.google.cloud.discoveryengine.v1.DataConnectorServiceSettings |
|
getStub()
public DataConnectorServiceStub getStub()| Returns | |
|---|---|
| Type | Description |
DataConnectorServiceStub |
|
isShutdown()
public boolean isShutdown()| Returns | |
|---|---|
| Type | Description |
boolean |
|
isTerminated()
public boolean isTerminated()| Returns | |
|---|---|
| Type | Description |
boolean |
|
setUpDataConnectorAsync(@Nullable LocationName parent, String collectionId, String collectionDisplayName, DataConnector dataConnector)
public final OperationFuture<DataConnector,SetUpDataConnectorMetadata> setUpDataConnectorAsync(@Nullable LocationName parent, String collectionId, String collectionDisplayName, DataConnector dataConnector)Creates a Collection and sets up the DataConnector for it. To stop a DataConnector after setup, use the CollectionService.DeleteCollection method.
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 (DataConnectorServiceClient dataConnectorServiceClient =
DataConnectorServiceClient.create()) {
LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]");
String collectionId = "collectionId1636075609";
String collectionDisplayName = "collectionDisplayName-330620689";
DataConnector dataConnector = DataConnector.newBuilder().build();
DataConnector response =
dataConnectorServiceClient
.setUpDataConnectorAsync(parent, collectionId, collectionDisplayName, dataConnector)
.get();
}
| Parameters | |
|---|---|
| Name | Description |
parent |
@org.jspecify.annotations.Nullable com.google.cloud.discoveryengine.v1.LocationNameRequired. The parent of Collection,
in the format of |
collectionId |
StringRequired. The ID to use for the Collection, which will become the final component of the Collection's resource name. A new Collection is created as part of the DataConnector setup. DataConnector is a singleton resource under Collection, managing all DataStores of the Collection. Should conform to RFC-1034 standard with a length
limit of 63 characters. Otherwise, an |
collectionDisplayName |
StringRequired. The display name of the Collection. Should be human readable, used to display collections in the Console Dashboard. UTF-8 encoded string with limit of 1024 characters. |
dataConnector |
DataConnectorRequired. The DataConnector to initialize in the newly created Collection. |
| Returns | |
|---|---|
| Type | Description |
OperationFuture<DataConnector,SetUpDataConnectorMetadata> |
|
setUpDataConnectorAsync(SetUpDataConnectorRequest request)
public final OperationFuture<DataConnector,SetUpDataConnectorMetadata> setUpDataConnectorAsync(SetUpDataConnectorRequest request)Creates a Collection and sets up the DataConnector for it. To stop a DataConnector after setup, use the CollectionService.DeleteCollection method.
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 (DataConnectorServiceClient dataConnectorServiceClient =
DataConnectorServiceClient.create()) {
SetUpDataConnectorRequest request =
SetUpDataConnectorRequest.newBuilder()
.setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString())
.setCollectionId("collectionId1636075609")
.setCollectionDisplayName("collectionDisplayName-330620689")
.setDataConnector(DataConnector.newBuilder().build())
.build();
DataConnector response = dataConnectorServiceClient.setUpDataConnectorAsync(request).get();
}
| Parameter | |
|---|---|
| Name | Description |
request |
SetUpDataConnectorRequestThe request object containing all of the parameters for the API call. |
| Returns | |
|---|---|
| Type | Description |
OperationFuture<DataConnector,SetUpDataConnectorMetadata> |
|
setUpDataConnectorAsync(String parent, String collectionId, String collectionDisplayName, DataConnector dataConnector)
public final OperationFuture<DataConnector,SetUpDataConnectorMetadata> setUpDataConnectorAsync(String parent, String collectionId, String collectionDisplayName, DataConnector dataConnector)Creates a Collection and sets up the DataConnector for it. To stop a DataConnector after setup, use the CollectionService.DeleteCollection method.
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 (DataConnectorServiceClient dataConnectorServiceClient =
DataConnectorServiceClient.create()) {
String parent = LocationName.of("[PROJECT]", "[LOCATION]").toString();
String collectionId = "collectionId1636075609";
String collectionDisplayName = "collectionDisplayName-330620689";
DataConnector dataConnector = DataConnector.newBuilder().build();
DataConnector response =
dataConnectorServiceClient
.setUpDataConnectorAsync(parent, collectionId, collectionDisplayName, dataConnector)
.get();
}
| Parameters | |
|---|---|
| Name | Description |
parent |
StringRequired. The parent of Collection,
in the format of |
collectionId |
StringRequired. The ID to use for the Collection, which will become the final component of the Collection's resource name. A new Collection is created as part of the DataConnector setup. DataConnector is a singleton resource under Collection, managing all DataStores of the Collection. Should conform to RFC-1034 standard with a length
limit of 63 characters. Otherwise, an |
collectionDisplayName |
StringRequired. The display name of the Collection. Should be human readable, used to display collections in the Console Dashboard. UTF-8 encoded string with limit of 1024 characters. |
dataConnector |
DataConnectorRequired. The DataConnector to initialize in the newly created Collection. |
| Returns | |
|---|---|
| Type | Description |
OperationFuture<DataConnector,SetUpDataConnectorMetadata> |
|
setUpDataConnectorCallable()
public final UnaryCallable<SetUpDataConnectorRequest,Operation> setUpDataConnectorCallable()Creates a Collection and sets up the DataConnector for it. To stop a DataConnector after setup, use the CollectionService.DeleteCollection method.
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 (DataConnectorServiceClient dataConnectorServiceClient =
DataConnectorServiceClient.create()) {
SetUpDataConnectorRequest request =
SetUpDataConnectorRequest.newBuilder()
.setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString())
.setCollectionId("collectionId1636075609")
.setCollectionDisplayName("collectionDisplayName-330620689")
.setDataConnector(DataConnector.newBuilder().build())
.build();
ApiFuture<Operation> future =
dataConnectorServiceClient.setUpDataConnectorCallable().futureCall(request);
// Do something.
Operation response = future.get();
}
| Returns | |
|---|---|
| Type | Description |
UnaryCallable<SetUpDataConnectorRequest,Operation> |
|
setUpDataConnectorOperationCallable()
public final OperationCallable<SetUpDataConnectorRequest,DataConnector,SetUpDataConnectorMetadata> setUpDataConnectorOperationCallable()Creates a Collection and sets up the DataConnector for it. To stop a DataConnector after setup, use the CollectionService.DeleteCollection method.
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 (DataConnectorServiceClient dataConnectorServiceClient =
DataConnectorServiceClient.create()) {
SetUpDataConnectorRequest request =
SetUpDataConnectorRequest.newBuilder()
.setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString())
.setCollectionId("collectionId1636075609")
.setCollectionDisplayName("collectionDisplayName-330620689")
.setDataConnector(DataConnector.newBuilder().build())
.build();
OperationFuture<DataConnector, SetUpDataConnectorMetadata> future =
dataConnectorServiceClient.setUpDataConnectorOperationCallable().futureCall(request);
// Do something.
DataConnector response = future.get();
}
| Returns | |
|---|---|
| Type | Description |
OperationCallable<SetUpDataConnectorRequest,DataConnector,SetUpDataConnectorMetadata> |
|
shutdown()
public void shutdown()shutdownNow()
public void shutdownNow()updateDataConnector(DataConnector dataConnector, FieldMask updateMask)
public final DataConnector updateDataConnector(DataConnector dataConnector, FieldMask updateMask)Updates a DataConnector.
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 (DataConnectorServiceClient dataConnectorServiceClient =
DataConnectorServiceClient.create()) {
DataConnector dataConnector = DataConnector.newBuilder().build();
FieldMask updateMask = FieldMask.newBuilder().build();
DataConnector response =
dataConnectorServiceClient.updateDataConnector(dataConnector, updateMask);
}
| Parameters | |
|---|---|
| Name | Description |
dataConnector |
DataConnectorRequired. The DataConnector to update. If the caller does not have permission to update the
DataConnector, regardless of whether or
not it exists, a If the DataConnector does not exist, a
|
updateMask |
FieldMaskIndicates which fields in the provided DataConnector to update. Supported field paths include: - Note: Support for these fields may vary depending on the connector type. For example,
not all connectors support If an unsupported or unknown field path is provided, the request will return an
|
| Returns | |
|---|---|
| Type | Description |
DataConnector |
|
updateDataConnector(UpdateDataConnectorRequest request)
public final DataConnector updateDataConnector(UpdateDataConnectorRequest request)Updates a DataConnector.
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 (DataConnectorServiceClient dataConnectorServiceClient =
DataConnectorServiceClient.create()) {
UpdateDataConnectorRequest request =
UpdateDataConnectorRequest.newBuilder()
.setDataConnector(DataConnector.newBuilder().build())
.setUpdateMask(FieldMask.newBuilder().build())
.build();
DataConnector response = dataConnectorServiceClient.updateDataConnector(request);
}
| Parameter | |
|---|---|
| Name | Description |
request |
UpdateDataConnectorRequestThe request object containing all of the parameters for the API call. |
| Returns | |
|---|---|
| Type | Description |
DataConnector |
|
updateDataConnectorCallable()
public final UnaryCallable<UpdateDataConnectorRequest,DataConnector> updateDataConnectorCallable()Updates a DataConnector.
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 (DataConnectorServiceClient dataConnectorServiceClient =
DataConnectorServiceClient.create()) {
UpdateDataConnectorRequest request =
UpdateDataConnectorRequest.newBuilder()
.setDataConnector(DataConnector.newBuilder().build())
.setUpdateMask(FieldMask.newBuilder().build())
.build();
ApiFuture<DataConnector> future =
dataConnectorServiceClient.updateDataConnectorCallable().futureCall(request);
// Do something.
DataConnector response = future.get();
}
| Returns | |
|---|---|
| Type | Description |
UnaryCallable<UpdateDataConnectorRequest,DataConnector> |
|