public class DataTransferServiceClient implements BackgroundResource
Service Description: This API allows users to manage their data transfers into BigQuery.
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 (DataTransferServiceClient dataTransferServiceClient = DataTransferServiceClient.create()) {
DataSourceName name =
DataSourceName.ofProjectLocationDataSourceName(
"[PROJECT]", "[LOCATION]", "[DATA_SOURCE]");
DataSource response = dataTransferServiceClient.getDataSource(name);
}
Note: close() needs to be called on the DataTransferServiceClient object to clean up resources such as threads. In the example above, try-with-resources is used, which automatically calls close().
The surface of this class includes several types of Java methods for each of the API's methods:
- A "flattened" method. With this type of method, the fields of the request type have been converted into function parameters. It may be the case that not all fields are available as parameters, and not every API method will have a flattened method entry point.
- A "request object" method. This type of method only takes one parameter, a request object, which must be constructed before the call. Not every API method will have a request object method.
- A "callable" method. This type of method takes no parameters and returns an immutable API callable object, which can be used to initiate calls to the service.
See the individual methods for example code.
Many parameters require resource names to be formatted in a particular way. To assist with these names, this class includes a format method for each type of name, and additionally a parse method to extract the individual identifiers contained within names that are returned.
This class can be customized by passing in a custom instance of DataTransferServiceSettings 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
DataTransferServiceSettings dataTransferServiceSettings =
DataTransferServiceSettings.newBuilder()
.setCredentialsProvider(FixedCredentialsProvider.create(myCredentials))
.build();
DataTransferServiceClient dataTransferServiceClient =
DataTransferServiceClient.create(dataTransferServiceSettings);
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
DataTransferServiceSettings dataTransferServiceSettings =
DataTransferServiceSettings.newBuilder().setEndpoint(myEndpoint).build();
DataTransferServiceClient dataTransferServiceClient =
DataTransferServiceClient.create(dataTransferServiceSettings);
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
DataTransferServiceSettings dataTransferServiceSettings =
DataTransferServiceSettings.newHttpJsonBuilder().build();
DataTransferServiceClient dataTransferServiceClient =
DataTransferServiceClient.create(dataTransferServiceSettings);
Please refer to the GitHub repository's samples for more quickstart code snippets.
Implements
BackgroundResourceStatic Methods
create()
public static final DataTransferServiceClient create()
Constructs an instance of DataTransferServiceClient with default settings.
Returns | |
---|---|
Type | Description |
DataTransferServiceClient |
Exceptions | |
---|---|
Type | Description |
IOException |
create(DataTransferServiceSettings settings)
public static final DataTransferServiceClient create(DataTransferServiceSettings settings)
Constructs an instance of DataTransferServiceClient, 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 | DataTransferServiceSettings |
Returns | |
---|---|
Type | Description |
DataTransferServiceClient |
Exceptions | |
---|---|
Type | Description |
IOException |
create(DataTransferServiceStub stub)
public static final DataTransferServiceClient create(DataTransferServiceStub stub)
Constructs an instance of DataTransferServiceClient, using the given stub for making calls. This is for advanced usage - prefer using create(DataTransferServiceSettings).
Parameter | |
---|---|
Name | Description |
stub | DataTransferServiceStub |
Returns | |
---|---|
Type | Description |
DataTransferServiceClient |
Constructors
DataTransferServiceClient(DataTransferServiceSettings settings)
protected DataTransferServiceClient(DataTransferServiceSettings settings)
Constructs an instance of DataTransferServiceClient, 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 | DataTransferServiceSettings |
DataTransferServiceClient(DataTransferServiceStub stub)
protected DataTransferServiceClient(DataTransferServiceStub stub)
Parameter | |
---|---|
Name | Description |
stub | DataTransferServiceStub |
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 |
checkValidCreds(CheckValidCredsRequest request)
public final CheckValidCredsResponse checkValidCreds(CheckValidCredsRequest request)
Returns true if valid credentials exist for the given data source and requesting user.
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 (DataTransferServiceClient dataTransferServiceClient = DataTransferServiceClient.create()) {
CheckValidCredsRequest request =
CheckValidCredsRequest.newBuilder()
.setName(
DataSourceName.ofProjectLocationDataSourceName(
"[PROJECT]", "[LOCATION]", "[DATA_SOURCE]")
.toString())
.build();
CheckValidCredsResponse response = dataTransferServiceClient.checkValidCreds(request);
}
Parameter | |
---|---|
Name | Description |
request | CheckValidCredsRequest The request object containing all of the parameters for the API call. |
Returns | |
---|---|
Type | Description |
CheckValidCredsResponse |
checkValidCreds(DataSourceName name)
public final CheckValidCredsResponse checkValidCreds(DataSourceName name)
Returns true if valid credentials exist for the given data source and requesting user.
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 (DataTransferServiceClient dataTransferServiceClient = DataTransferServiceClient.create()) {
DataSourceName name =
DataSourceName.ofProjectLocationDataSourceName(
"[PROJECT]", "[LOCATION]", "[DATA_SOURCE]");
CheckValidCredsResponse response = dataTransferServiceClient.checkValidCreds(name);
}
Parameter | |
---|---|
Name | Description |
name | DataSourceName Required. The data source in the form:
|
Returns | |
---|---|
Type | Description |
CheckValidCredsResponse |
checkValidCreds(String name)
public final CheckValidCredsResponse checkValidCreds(String name)
Returns true if valid credentials exist for the given data source and requesting user.
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 (DataTransferServiceClient dataTransferServiceClient = DataTransferServiceClient.create()) {
String name = DataSourceName.ofProjectDataSourceName("[PROJECT]", "[DATA_SOURCE]").toString();
CheckValidCredsResponse response = dataTransferServiceClient.checkValidCreds(name);
}
Parameter | |
---|---|
Name | Description |
name | String Required. The data source in the form:
|
Returns | |
---|---|
Type | Description |
CheckValidCredsResponse |
checkValidCredsCallable()
public final UnaryCallable<CheckValidCredsRequest,CheckValidCredsResponse> checkValidCredsCallable()
Returns true if valid credentials exist for the given data source and requesting user.
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 (DataTransferServiceClient dataTransferServiceClient = DataTransferServiceClient.create()) {
CheckValidCredsRequest request =
CheckValidCredsRequest.newBuilder()
.setName(
DataSourceName.ofProjectLocationDataSourceName(
"[PROJECT]", "[LOCATION]", "[DATA_SOURCE]")
.toString())
.build();
ApiFuture<CheckValidCredsResponse> future =
dataTransferServiceClient.checkValidCredsCallable().futureCall(request);
// Do something.
CheckValidCredsResponse response = future.get();
}
Returns | |
---|---|
Type | Description |
UnaryCallable<CheckValidCredsRequest,CheckValidCredsResponse> |
close()
public final void close()
createTransferConfig(CreateTransferConfigRequest request)
public final TransferConfig createTransferConfig(CreateTransferConfigRequest request)
Creates a new data transfer configuration.
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 (DataTransferServiceClient dataTransferServiceClient = DataTransferServiceClient.create()) {
CreateTransferConfigRequest request =
CreateTransferConfigRequest.newBuilder()
.setParent(ProjectName.of("[PROJECT]").toString())
.setTransferConfig(TransferConfig.newBuilder().build())
.setAuthorizationCode("authorizationCode742596102")
.setVersionInfo("versionInfo688769446")
.setServiceAccountName("serviceAccountName2137368675")
.build();
TransferConfig response = dataTransferServiceClient.createTransferConfig(request);
}
Parameter | |
---|---|
Name | Description |
request | CreateTransferConfigRequest The request object containing all of the parameters for the API call. |
Returns | |
---|---|
Type | Description |
TransferConfig |
createTransferConfig(LocationName parent, TransferConfig transferConfig)
public final TransferConfig createTransferConfig(LocationName parent, TransferConfig transferConfig)
Creates a new data transfer configuration.
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 (DataTransferServiceClient dataTransferServiceClient = DataTransferServiceClient.create()) {
LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]");
TransferConfig transferConfig = TransferConfig.newBuilder().build();
TransferConfig response =
dataTransferServiceClient.createTransferConfig(parent, transferConfig);
}
Parameters | |
---|---|
Name | Description |
parent | LocationName Required. The BigQuery project id where the transfer configuration should be created. Must be in the format projects/{project_id}/locations/{location_id} or projects/{project_id}. If specified location and location of the destination bigquery dataset do not match - the request will fail. |
transferConfig | TransferConfig Required. Data transfer configuration to create. |
Returns | |
---|---|
Type | Description |
TransferConfig |
createTransferConfig(ProjectName parent, TransferConfig transferConfig)
public final TransferConfig createTransferConfig(ProjectName parent, TransferConfig transferConfig)
Creates a new data transfer configuration.
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 (DataTransferServiceClient dataTransferServiceClient = DataTransferServiceClient.create()) {
ProjectName parent = ProjectName.of("[PROJECT]");
TransferConfig transferConfig = TransferConfig.newBuilder().build();
TransferConfig response =
dataTransferServiceClient.createTransferConfig(parent, transferConfig);
}
Parameters | |
---|---|
Name | Description |
parent | ProjectName Required. The BigQuery project id where the transfer configuration should be created. Must be in the format projects/{project_id}/locations/{location_id} or projects/{project_id}. If specified location and location of the destination bigquery dataset do not match - the request will fail. |
transferConfig | TransferConfig Required. Data transfer configuration to create. |
Returns | |
---|---|
Type | Description |
TransferConfig |
createTransferConfig(String parent, TransferConfig transferConfig)
public final TransferConfig createTransferConfig(String parent, TransferConfig transferConfig)
Creates a new data transfer configuration.
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 (DataTransferServiceClient dataTransferServiceClient = DataTransferServiceClient.create()) {
String parent = ProjectName.of("[PROJECT]").toString();
TransferConfig transferConfig = TransferConfig.newBuilder().build();
TransferConfig response =
dataTransferServiceClient.createTransferConfig(parent, transferConfig);
}
Parameters | |
---|---|
Name | Description |
parent | String Required. The BigQuery project id where the transfer configuration should be created. Must be in the format projects/{project_id}/locations/{location_id} or projects/{project_id}. If specified location and location of the destination bigquery dataset do not match - the request will fail. |
transferConfig | TransferConfig Required. Data transfer configuration to create. |
Returns | |
---|---|
Type | Description |
TransferConfig |
createTransferConfigCallable()
public final UnaryCallable<CreateTransferConfigRequest,TransferConfig> createTransferConfigCallable()
Creates a new data transfer configuration.
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 (DataTransferServiceClient dataTransferServiceClient = DataTransferServiceClient.create()) {
CreateTransferConfigRequest request =
CreateTransferConfigRequest.newBuilder()
.setParent(ProjectName.of("[PROJECT]").toString())
.setTransferConfig(TransferConfig.newBuilder().build())
.setAuthorizationCode("authorizationCode742596102")
.setVersionInfo("versionInfo688769446")
.setServiceAccountName("serviceAccountName2137368675")
.build();
ApiFuture<TransferConfig> future =
dataTransferServiceClient.createTransferConfigCallable().futureCall(request);
// Do something.
TransferConfig response = future.get();
}
Returns | |
---|---|
Type | Description |
UnaryCallable<CreateTransferConfigRequest,TransferConfig> |
deleteTransferConfig(DeleteTransferConfigRequest request)
public final void deleteTransferConfig(DeleteTransferConfigRequest request)
Deletes a data transfer configuration, including any associated transfer runs and logs.
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 (DataTransferServiceClient dataTransferServiceClient = DataTransferServiceClient.create()) {
DeleteTransferConfigRequest request =
DeleteTransferConfigRequest.newBuilder()
.setName(
TransferConfigName.ofProjectLocationTransferConfigName(
"[PROJECT]", "[LOCATION]", "[TRANSFER_CONFIG]")
.toString())
.build();
dataTransferServiceClient.deleteTransferConfig(request);
}
Parameter | |
---|---|
Name | Description |
request | DeleteTransferConfigRequest The request object containing all of the parameters for the API call. |
deleteTransferConfig(TransferConfigName name)
public final void deleteTransferConfig(TransferConfigName name)
Deletes a data transfer configuration, including any associated transfer runs and logs.
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 (DataTransferServiceClient dataTransferServiceClient = DataTransferServiceClient.create()) {
TransferConfigName name =
TransferConfigName.ofProjectLocationTransferConfigName(
"[PROJECT]", "[LOCATION]", "[TRANSFER_CONFIG]");
dataTransferServiceClient.deleteTransferConfig(name);
}
Parameter | |
---|---|
Name | Description |
name | TransferConfigName Required. The field will contain name of the resource requested, for example:
|
deleteTransferConfig(String name)
public final void deleteTransferConfig(String name)
Deletes a data transfer configuration, including any associated transfer runs and logs.
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 (DataTransferServiceClient dataTransferServiceClient = DataTransferServiceClient.create()) {
String name =
TransferConfigName.ofProjectTransferConfigName("[PROJECT]", "[TRANSFER_CONFIG]")
.toString();
dataTransferServiceClient.deleteTransferConfig(name);
}
Parameter | |
---|---|
Name | Description |
name | String Required. The field will contain name of the resource requested, for example:
|
deleteTransferConfigCallable()
public final UnaryCallable<DeleteTransferConfigRequest,Empty> deleteTransferConfigCallable()
Deletes a data transfer configuration, including any associated transfer runs and logs.
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 (DataTransferServiceClient dataTransferServiceClient = DataTransferServiceClient.create()) {
DeleteTransferConfigRequest request =
DeleteTransferConfigRequest.newBuilder()
.setName(
TransferConfigName.ofProjectLocationTransferConfigName(
"[PROJECT]", "[LOCATION]", "[TRANSFER_CONFIG]")
.toString())
.build();
ApiFuture<Empty> future =
dataTransferServiceClient.deleteTransferConfigCallable().futureCall(request);
// Do something.
future.get();
}
Returns | |
---|---|
Type | Description |
UnaryCallable<DeleteTransferConfigRequest,Empty> |
deleteTransferRun(DeleteTransferRunRequest request)
public final void deleteTransferRun(DeleteTransferRunRequest request)
Deletes the specified transfer run.
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 (DataTransferServiceClient dataTransferServiceClient = DataTransferServiceClient.create()) {
DeleteTransferRunRequest request =
DeleteTransferRunRequest.newBuilder()
.setName(
RunName.ofProjectLocationTransferConfigRunName(
"[PROJECT]", "[LOCATION]", "[TRANSFER_CONFIG]", "[RUN]")
.toString())
.build();
dataTransferServiceClient.deleteTransferRun(request);
}
Parameter | |
---|---|
Name | Description |
request | DeleteTransferRunRequest The request object containing all of the parameters for the API call. |
deleteTransferRun(RunName name)
public final void deleteTransferRun(RunName name)
Deletes the specified transfer run.
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 (DataTransferServiceClient dataTransferServiceClient = DataTransferServiceClient.create()) {
RunName name =
RunName.ofProjectLocationTransferConfigRunName(
"[PROJECT]", "[LOCATION]", "[TRANSFER_CONFIG]", "[RUN]");
dataTransferServiceClient.deleteTransferRun(name);
}
Parameter | |
---|---|
Name | Description |
name | RunName Required. The field will contain name of the resource requested, for example:
|
deleteTransferRun(String name)
public final void deleteTransferRun(String name)
Deletes the specified transfer run.
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 (DataTransferServiceClient dataTransferServiceClient = DataTransferServiceClient.create()) {
String name =
RunName.ofProjectTransferConfigRunName("[PROJECT]", "[TRANSFER_CONFIG]", "[RUN]")
.toString();
dataTransferServiceClient.deleteTransferRun(name);
}
Parameter | |
---|---|
Name | Description |
name | String Required. The field will contain name of the resource requested, for example:
|
deleteTransferRunCallable()
public final UnaryCallable<DeleteTransferRunRequest,Empty> deleteTransferRunCallable()
Deletes the specified transfer run.
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 (DataTransferServiceClient dataTransferServiceClient = DataTransferServiceClient.create()) {
DeleteTransferRunRequest request =
DeleteTransferRunRequest.newBuilder()
.setName(
RunName.ofProjectLocationTransferConfigRunName(
"[PROJECT]", "[LOCATION]", "[TRANSFER_CONFIG]", "[RUN]")
.toString())
.build();
ApiFuture<Empty> future =
dataTransferServiceClient.deleteTransferRunCallable().futureCall(request);
// Do something.
future.get();
}
Returns | |
---|---|
Type | Description |
UnaryCallable<DeleteTransferRunRequest,Empty> |
enrollDataSources(EnrollDataSourcesRequest request)
public final void enrollDataSources(EnrollDataSourcesRequest request)
Enroll data sources in a user project. This allows users to create transfer configurations for these data sources. They will also appear in the ListDataSources RPC and as such, will appear in the BigQuery UI, and the documents can be found in the public guide for BigQuery Web UI and Data Transfer Service.
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (DataTransferServiceClient dataTransferServiceClient = DataTransferServiceClient.create()) {
EnrollDataSourcesRequest request =
EnrollDataSourcesRequest.newBuilder()
.setName("name3373707")
.addAllDataSourceIds(new ArrayList<String>())
.build();
dataTransferServiceClient.enrollDataSources(request);
}
Parameter | |
---|---|
Name | Description |
request | EnrollDataSourcesRequest The request object containing all of the parameters for the API call. |
enrollDataSourcesCallable()
public final UnaryCallable<EnrollDataSourcesRequest,Empty> enrollDataSourcesCallable()
Enroll data sources in a user project. This allows users to create transfer configurations for these data sources. They will also appear in the ListDataSources RPC and as such, will appear in the BigQuery UI, and the documents can be found in the public guide for BigQuery Web UI and Data Transfer Service.
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (DataTransferServiceClient dataTransferServiceClient = DataTransferServiceClient.create()) {
EnrollDataSourcesRequest request =
EnrollDataSourcesRequest.newBuilder()
.setName("name3373707")
.addAllDataSourceIds(new ArrayList<String>())
.build();
ApiFuture<Empty> future =
dataTransferServiceClient.enrollDataSourcesCallable().futureCall(request);
// Do something.
future.get();
}
Returns | |
---|---|
Type | Description |
UnaryCallable<EnrollDataSourcesRequest,Empty> |
getDataSource(DataSourceName name)
public final DataSource getDataSource(DataSourceName name)
Retrieves a supported data source and returns its settings.
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 (DataTransferServiceClient dataTransferServiceClient = DataTransferServiceClient.create()) {
DataSourceName name =
DataSourceName.ofProjectLocationDataSourceName(
"[PROJECT]", "[LOCATION]", "[DATA_SOURCE]");
DataSource response = dataTransferServiceClient.getDataSource(name);
}
Parameter | |
---|---|
Name | Description |
name | DataSourceName Required. The field will contain name of the resource requested, for example:
|
Returns | |
---|---|
Type | Description |
DataSource |
getDataSource(GetDataSourceRequest request)
public final DataSource getDataSource(GetDataSourceRequest request)
Retrieves a supported data source and returns its settings.
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 (DataTransferServiceClient dataTransferServiceClient = DataTransferServiceClient.create()) {
GetDataSourceRequest request =
GetDataSourceRequest.newBuilder()
.setName(
DataSourceName.ofProjectLocationDataSourceName(
"[PROJECT]", "[LOCATION]", "[DATA_SOURCE]")
.toString())
.build();
DataSource response = dataTransferServiceClient.getDataSource(request);
}
Parameter | |
---|---|
Name | Description |
request | GetDataSourceRequest The request object containing all of the parameters for the API call. |
Returns | |
---|---|
Type | Description |
DataSource |
getDataSource(String name)
public final DataSource getDataSource(String name)
Retrieves a supported data source and returns its settings.
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 (DataTransferServiceClient dataTransferServiceClient = DataTransferServiceClient.create()) {
String name = DataSourceName.ofProjectDataSourceName("[PROJECT]", "[DATA_SOURCE]").toString();
DataSource response = dataTransferServiceClient.getDataSource(name);
}
Parameter | |
---|---|
Name | Description |
name | String Required. The field will contain name of the resource requested, for example:
|
Returns | |
---|---|
Type | Description |
DataSource |
getDataSourceCallable()
public final UnaryCallable<GetDataSourceRequest,DataSource> getDataSourceCallable()
Retrieves a supported data source and returns its settings.
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 (DataTransferServiceClient dataTransferServiceClient = DataTransferServiceClient.create()) {
GetDataSourceRequest request =
GetDataSourceRequest.newBuilder()
.setName(
DataSourceName.ofProjectLocationDataSourceName(
"[PROJECT]", "[LOCATION]", "[DATA_SOURCE]")
.toString())
.build();
ApiFuture<DataSource> future =
dataTransferServiceClient.getDataSourceCallable().futureCall(request);
// Do something.
DataSource response = future.get();
}
Returns | |
---|---|
Type | Description |
UnaryCallable<GetDataSourceRequest,DataSource> |
getLocation(GetLocationRequest request)
public final Location getLocation(GetLocationRequest request)
Gets information about a location.
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (DataTransferServiceClient dataTransferServiceClient = DataTransferServiceClient.create()) {
GetLocationRequest request = GetLocationRequest.newBuilder().setName("name3373707").build();
Location response = dataTransferServiceClient.getLocation(request);
}
Parameter | |
---|---|
Name | Description |
request | com.google.cloud.location.GetLocationRequest The request object containing all of the parameters for the API call. |
Returns | |
---|---|
Type | Description |
com.google.cloud.location.Location |
getLocationCallable()
public final UnaryCallable<GetLocationRequest,Location> getLocationCallable()
Gets information about a location.
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (DataTransferServiceClient dataTransferServiceClient = DataTransferServiceClient.create()) {
GetLocationRequest request = GetLocationRequest.newBuilder().setName("name3373707").build();
ApiFuture<Location> future =
dataTransferServiceClient.getLocationCallable().futureCall(request);
// Do something.
Location response = future.get();
}
Returns | |
---|---|
Type | Description |
UnaryCallable<com.google.cloud.location.GetLocationRequest,com.google.cloud.location.Location> |
getSettings()
public final DataTransferServiceSettings getSettings()
Returns | |
---|---|
Type | Description |
DataTransferServiceSettings |
getStub()
public DataTransferServiceStub getStub()
Returns | |
---|---|
Type | Description |
DataTransferServiceStub |
getTransferConfig(GetTransferConfigRequest request)
public final TransferConfig getTransferConfig(GetTransferConfigRequest request)
Returns information about a data transfer config.
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 (DataTransferServiceClient dataTransferServiceClient = DataTransferServiceClient.create()) {
GetTransferConfigRequest request =
GetTransferConfigRequest.newBuilder()
.setName(
TransferConfigName.ofProjectLocationTransferConfigName(
"[PROJECT]", "[LOCATION]", "[TRANSFER_CONFIG]")
.toString())
.build();
TransferConfig response = dataTransferServiceClient.getTransferConfig(request);
}
Parameter | |
---|---|
Name | Description |
request | GetTransferConfigRequest The request object containing all of the parameters for the API call. |
Returns | |
---|---|
Type | Description |
TransferConfig |
getTransferConfig(TransferConfigName name)
public final TransferConfig getTransferConfig(TransferConfigName name)
Returns information about a data transfer config.
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 (DataTransferServiceClient dataTransferServiceClient = DataTransferServiceClient.create()) {
TransferConfigName name =
TransferConfigName.ofProjectLocationTransferConfigName(
"[PROJECT]", "[LOCATION]", "[TRANSFER_CONFIG]");
TransferConfig response = dataTransferServiceClient.getTransferConfig(name);
}
Parameter | |
---|---|
Name | Description |
name | TransferConfigName Required. The field will contain name of the resource requested, for example:
|
Returns | |
---|---|
Type | Description |
TransferConfig |
getTransferConfig(String name)
public final TransferConfig getTransferConfig(String name)
Returns information about a data transfer config.
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 (DataTransferServiceClient dataTransferServiceClient = DataTransferServiceClient.create()) {
String name =
TransferConfigName.ofProjectTransferConfigName("[PROJECT]", "[TRANSFER_CONFIG]")
.toString();
TransferConfig response = dataTransferServiceClient.getTransferConfig(name);
}
Parameter | |
---|---|
Name | Description |
name | String Required. The field will contain name of the resource requested, for example:
|
Returns | |
---|---|
Type | Description |
TransferConfig |
getTransferConfigCallable()
public final UnaryCallable<GetTransferConfigRequest,TransferConfig> getTransferConfigCallable()
Returns information about a data transfer config.
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 (DataTransferServiceClient dataTransferServiceClient = DataTransferServiceClient.create()) {
GetTransferConfigRequest request =
GetTransferConfigRequest.newBuilder()
.setName(
TransferConfigName.ofProjectLocationTransferConfigName(
"[PROJECT]", "[LOCATION]", "[TRANSFER_CONFIG]")
.toString())
.build();
ApiFuture<TransferConfig> future =
dataTransferServiceClient.getTransferConfigCallable().futureCall(request);
// Do something.
TransferConfig response = future.get();
}
Returns | |
---|---|
Type | Description |
UnaryCallable<GetTransferConfigRequest,TransferConfig> |