Class DataTransferServiceClient (2.78.0)

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(DataTransferServiceClientdataTransferServiceClient=DataTransferServiceClient.create()){
DataSourceNamename=
DataSourceName.ofProjectLocationDataSourceName(
"[PROJECT]","[LOCATION]","[DATA_SOURCE]");
DataSourceresponse=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().

Methods
Method Description Method Variants

GetDataSource

Retrieves a supported data source and returns its settings.

Request object method variants only take one parameter, a request object, which must be constructed before the call.

  • getDataSource(GetDataSourceRequest request)

"Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method.

  • getDataSource(DataSourceName name)

  • getDataSource(String name)

Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.

  • getDataSourceCallable()

ListDataSources

Lists supported data sources and returns their settings.

Request object method variants only take one parameter, a request object, which must be constructed before the call.

  • listDataSources(ListDataSourcesRequest request)

"Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method.

  • listDataSources(LocationName parent)

  • listDataSources(ProjectName parent)

  • listDataSources(String parent)

Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.

  • listDataSourcesPagedCallable()

  • listDataSourcesCallable()

CreateTransferConfig

Creates a new data transfer configuration.

Request object method variants only take one parameter, a request object, which must be constructed before the call.

  • createTransferConfig(CreateTransferConfigRequest request)

"Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method.

  • createTransferConfig(LocationName parent, TransferConfig transferConfig)

  • createTransferConfig(ProjectName parent, TransferConfig transferConfig)

  • createTransferConfig(String parent, TransferConfig transferConfig)

Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.

  • createTransferConfigCallable()

UpdateTransferConfig

Updates a data transfer configuration. All fields must be set, even if they are not updated.

Request object method variants only take one parameter, a request object, which must be constructed before the call.

  • updateTransferConfig(UpdateTransferConfigRequest request)

"Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method.

  • updateTransferConfig(TransferConfig transferConfig, FieldMask updateMask)

Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.

  • updateTransferConfigCallable()

DeleteTransferConfig

Deletes a data transfer configuration, including any associated transfer runs and logs.

Request object method variants only take one parameter, a request object, which must be constructed before the call.

  • deleteTransferConfig(DeleteTransferConfigRequest request)

"Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method.

  • deleteTransferConfig(TransferConfigName name)

  • deleteTransferConfig(String name)

Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.

  • deleteTransferConfigCallable()

GetTransferConfig

Returns information about a data transfer config.

Request object method variants only take one parameter, a request object, which must be constructed before the call.

  • getTransferConfig(GetTransferConfigRequest request)

"Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method.

  • getTransferConfig(TransferConfigName name)

  • getTransferConfig(String name)

Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.

  • getTransferConfigCallable()

ListTransferConfigs

Returns information about all transfer configs owned by a project in the specified location.

Request object method variants only take one parameter, a request object, which must be constructed before the call.

  • listTransferConfigs(ListTransferConfigsRequest request)

"Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method.

  • listTransferConfigs(LocationName parent)

  • listTransferConfigs(ProjectName parent)

  • listTransferConfigs(String parent)

Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.

  • listTransferConfigsPagedCallable()

  • listTransferConfigsCallable()

ScheduleTransferRuns

Creates transfer runs for a time range [start_time, end_time]. For each date - or whatever granularity the data source supports - in the range, one transfer run is created. Note that runs are created per UTC time in the time range. DEPRECATED: use StartManualTransferRuns instead.

Request object method variants only take one parameter, a request object, which must be constructed before the call.

  • scheduleTransferRuns(ScheduleTransferRunsRequest request)

"Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method.

  • scheduleTransferRuns(TransferConfigName parent, Timestamp startTime, Timestamp endTime)

  • scheduleTransferRuns(String parent, Timestamp startTime, Timestamp endTime)

Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.

  • scheduleTransferRunsCallable()

StartManualTransferRuns

Start manual transfer runs to be executed now with schedule_time equal to current time. The transfer runs can be created for a time range where the run_time is between start_time (inclusive) and end_time (exclusive), or for a specific run_time.

Request object method variants only take one parameter, a request object, which must be constructed before the call.

  • startManualTransferRuns(StartManualTransferRunsRequest request)

Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.

  • startManualTransferRunsCallable()

GetTransferRun

Returns information about the particular transfer run.

Request object method variants only take one parameter, a request object, which must be constructed before the call.

  • getTransferRun(GetTransferRunRequest request)

"Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method.

  • getTransferRun(RunName name)

  • getTransferRun(String name)

Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.

  • getTransferRunCallable()

DeleteTransferRun

Deletes the specified transfer run.

Request object method variants only take one parameter, a request object, which must be constructed before the call.

  • deleteTransferRun(DeleteTransferRunRequest request)

"Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method.

  • deleteTransferRun(RunName name)

  • deleteTransferRun(String name)

Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.

  • deleteTransferRunCallable()

ListTransferRuns

Returns information about running and completed transfer runs.

Request object method variants only take one parameter, a request object, which must be constructed before the call.

  • listTransferRuns(ListTransferRunsRequest request)

"Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method.

  • listTransferRuns(TransferConfigName parent)

  • listTransferRuns(String parent)

Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.

  • listTransferRunsPagedCallable()

  • listTransferRunsCallable()

ListTransferLogs

Returns log messages for the transfer run.

Request object method variants only take one parameter, a request object, which must be constructed before the call.

  • listTransferLogs(ListTransferLogsRequest request)

"Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method.

  • listTransferLogs(RunName parent)

  • listTransferLogs(String parent)

Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.

  • listTransferLogsPagedCallable()

  • listTransferLogsCallable()

CheckValidCreds

Returns true if valid credentials exist for the given data source and requesting user.

Request object method variants only take one parameter, a request object, which must be constructed before the call.

  • checkValidCreds(CheckValidCredsRequest request)

"Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method.

  • checkValidCreds(DataSourceName name)

  • checkValidCreds(String name)

Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.

  • checkValidCredsCallable()

EnrollDataSources

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.

Request object method variants only take one parameter, a request object, which must be constructed before the call.

  • enrollDataSources(EnrollDataSourcesRequest request)

Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.

  • enrollDataSourcesCallable()

UnenrollDataSources

Unenroll data sources in a user project. This allows users to remove transfer configurations for these data sources. They will no longer appear in the ListDataSources RPC and will also no longer appear in the BigQuery UI. Data transfers configurations of unenrolled data sources will not be scheduled.

Request object method variants only take one parameter, a request object, which must be constructed before the call.

  • unenrollDataSources(UnenrollDataSourcesRequest request)

Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.

  • unenrollDataSourcesCallable()

ListLocations

Lists information about the supported locations for this service.

Request object method variants only take one parameter, a request object, which must be constructed before the call.

  • listLocations(ListLocationsRequest request)

Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.

  • listLocationsPagedCallable()

  • listLocationsCallable()

GetLocation

Gets information about a location.

Request object method variants only take one parameter, a request object, which must be constructed before the call.

  • getLocation(GetLocationRequest request)

Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.

  • getLocationCallable()

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
DataTransferServiceSettingsdataTransferServiceSettings=
DataTransferServiceSettings.newBuilder()
.setCredentialsProvider(FixedCredentialsProvider.create(myCredentials))
.build();
DataTransferServiceClientdataTransferServiceClient=
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
DataTransferServiceSettingsdataTransferServiceSettings=
DataTransferServiceSettings.newBuilder().setEndpoint(myEndpoint).build();
DataTransferServiceClientdataTransferServiceClient=
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
DataTransferServiceSettingsdataTransferServiceSettings=
DataTransferServiceSettings.newHttpJsonBuilder().build();
DataTransferServiceClientdataTransferServiceClient=
DataTransferServiceClient.create(dataTransferServiceSettings);

Please refer to the GitHub repository's samples for more quickstart code snippets.

Inheritance

java.lang.Object > DataTransferServiceClient

Static Methods

create()

publicstaticfinalDataTransferServiceClientcreate()

Constructs an instance of DataTransferServiceClient with default settings.

Returns
Type Description
DataTransferServiceClient
Exceptions
Type Description
IOException

create(DataTransferServiceSettings settings)

publicstaticfinalDataTransferServiceClientcreate(DataTransferServiceSettingssettings)

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)

publicstaticfinalDataTransferServiceClientcreate(DataTransferServiceStubstub)

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)

protectedDataTransferServiceClient(DataTransferServiceSettingssettings)

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)

protectedDataTransferServiceClient(DataTransferServiceStubstub)
Parameter
Name Description
stub DataTransferServiceStub

Methods

awaitTermination(long duration, TimeUnit unit)

publicbooleanawaitTermination(longduration,TimeUnitunit)
Parameters
Name Description
duration long
unit TimeUnit
Returns
Type Description
boolean
Exceptions
Type Description
InterruptedException

checkValidCreds(CheckValidCredsRequest request)

publicfinalCheckValidCredsResponsecheckValidCreds(CheckValidCredsRequestrequest)

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(DataTransferServiceClientdataTransferServiceClient=DataTransferServiceClient.create()){
CheckValidCredsRequestrequest=
CheckValidCredsRequest.newBuilder()
.setName(
DataSourceName.ofProjectLocationDataSourceName(
"[PROJECT]","[LOCATION]","[DATA_SOURCE]")
.toString())
.build();
CheckValidCredsResponseresponse=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)

publicfinalCheckValidCredsResponsecheckValidCreds(DataSourceNamename)

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(DataTransferServiceClientdataTransferServiceClient=DataTransferServiceClient.create()){
DataSourceNamename=
DataSourceName.ofProjectLocationDataSourceName(
"[PROJECT]","[LOCATION]","[DATA_SOURCE]");
CheckValidCredsResponseresponse=dataTransferServiceClient.checkValidCreds(name);
}
Parameter
Name Description
name DataSourceName

Required. The data source in the form: projects/{project_id}/dataSources/{data_source_id} or projects/{project_id}/locations/{location_id}/dataSources/{data_source_id}.

Returns
Type Description
CheckValidCredsResponse

checkValidCreds(String name)

publicfinalCheckValidCredsResponsecheckValidCreds(Stringname)

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(DataTransferServiceClientdataTransferServiceClient=DataTransferServiceClient.create()){
Stringname=DataSourceName.ofProjectDataSourceName("[PROJECT]","[DATA_SOURCE]").toString();
CheckValidCredsResponseresponse=dataTransferServiceClient.checkValidCreds(name);
}
Parameter
Name Description
name String

Required. The data source in the form: projects/{project_id}/dataSources/{data_source_id} or projects/{project_id}/locations/{location_id}/dataSources/{data_source_id}.

Returns
Type Description
CheckValidCredsResponse

checkValidCredsCallable()

publicfinalUnaryCallable<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(DataTransferServiceClientdataTransferServiceClient=DataTransferServiceClient.create()){
CheckValidCredsRequestrequest=
CheckValidCredsRequest.newBuilder()
.setName(
DataSourceName.ofProjectLocationDataSourceName(
"[PROJECT]","[LOCATION]","[DATA_SOURCE]")
.toString())
.build();
ApiFuture<CheckValidCredsResponse>future=
dataTransferServiceClient.checkValidCredsCallable().futureCall(request);
// Do something.
CheckValidCredsResponseresponse=future.get();
}
Returns
Type Description
UnaryCallable<CheckValidCredsRequest,CheckValidCredsResponse>

close()

publicfinalvoidclose()

createTransferConfig(CreateTransferConfigRequest request)

publicfinalTransferConfigcreateTransferConfig(CreateTransferConfigRequestrequest)

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(DataTransferServiceClientdataTransferServiceClient=DataTransferServiceClient.create()){
CreateTransferConfigRequestrequest=
CreateTransferConfigRequest.newBuilder()
.setParent(ProjectName.of("[PROJECT]").toString())
.setTransferConfig(TransferConfig.newBuilder().build())
.setAuthorizationCode("authorizationCode742596102")
.setVersionInfo("versionInfo688769446")
.setServiceAccountName("serviceAccountName2137368675")
.build();
TransferConfigresponse=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)

publicfinalTransferConfigcreateTransferConfig(LocationNameparent,TransferConfigtransferConfig)

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(DataTransferServiceClientdataTransferServiceClient=DataTransferServiceClient.create()){
LocationNameparent=LocationName.of("[PROJECT]","[LOCATION]");
TransferConfigtransferConfig=TransferConfig.newBuilder().build();
TransferConfigresponse=
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)

publicfinalTransferConfigcreateTransferConfig(ProjectNameparent,TransferConfigtransferConfig)

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(DataTransferServiceClientdataTransferServiceClient=DataTransferServiceClient.create()){
ProjectNameparent=ProjectName.of("[PROJECT]");
TransferConfigtransferConfig=TransferConfig.newBuilder().build();
TransferConfigresponse=
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)

publicfinalTransferConfigcreateTransferConfig(Stringparent,TransferConfigtransferConfig)

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(DataTransferServiceClientdataTransferServiceClient=DataTransferServiceClient.create()){
Stringparent=ProjectName.of("[PROJECT]").toString();
TransferConfigtransferConfig=TransferConfig.newBuilder().build();
TransferConfigresponse=
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()

publicfinalUnaryCallable<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(DataTransferServiceClientdataTransferServiceClient=DataTransferServiceClient.create()){
CreateTransferConfigRequestrequest=
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.
TransferConfigresponse=future.get();
}
Returns
Type Description
UnaryCallable<CreateTransferConfigRequest,TransferConfig>

deleteTransferConfig(DeleteTransferConfigRequest request)

publicfinalvoiddeleteTransferConfig(DeleteTransferConfigRequestrequest)

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(DataTransferServiceClientdataTransferServiceClient=DataTransferServiceClient.create()){
DeleteTransferConfigRequestrequest=
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)

publicfinalvoiddeleteTransferConfig(TransferConfigNamename)

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(DataTransferServiceClientdataTransferServiceClient=DataTransferServiceClient.create()){
TransferConfigNamename=
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: projects/{project_id}/transferConfigs/{config_id} or projects/{project_id}/locations/{location_id}/transferConfigs/{config_id}

deleteTransferConfig(String name)

publicfinalvoiddeleteTransferConfig(Stringname)

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(DataTransferServiceClientdataTransferServiceClient=DataTransferServiceClient.create()){
Stringname=
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: projects/{project_id}/transferConfigs/{config_id} or projects/{project_id}/locations/{location_id}/transferConfigs/{config_id}

deleteTransferConfigCallable()

publicfinalUnaryCallable<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(DataTransferServiceClientdataTransferServiceClient=DataTransferServiceClient.create()){
DeleteTransferConfigRequestrequest=
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)

publicfinalvoiddeleteTransferRun(DeleteTransferRunRequestrequest)

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(DataTransferServiceClientdataTransferServiceClient=DataTransferServiceClient.create()){
DeleteTransferRunRequestrequest=
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)

publicfinalvoiddeleteTransferRun(RunNamename)

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(DataTransferServiceClientdataTransferServiceClient=DataTransferServiceClient.create()){
RunNamename=
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: projects/{project_id}/transferConfigs/{config_id}/runs/{run_id} or projects/{project_id}/locations/{location_id}/transferConfigs/{config_id}/runs/{run_id}

deleteTransferRun(String name)

publicfinalvoiddeleteTransferRun(Stringname)

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(DataTransferServiceClientdataTransferServiceClient=DataTransferServiceClient.create()){
Stringname=
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: projects/{project_id}/transferConfigs/{config_id}/runs/{run_id} or projects/{project_id}/locations/{location_id}/transferConfigs/{config_id}/runs/{run_id}

deleteTransferRunCallable()

publicfinalUnaryCallable<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(DataTransferServiceClientdataTransferServiceClient=DataTransferServiceClient.create()){
DeleteTransferRunRequestrequest=
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)

publicfinalvoidenrollDataSources(EnrollDataSourcesRequestrequest)

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(DataTransferServiceClientdataTransferServiceClient=DataTransferServiceClient.create()){
EnrollDataSourcesRequestrequest=
EnrollDataSourcesRequest.newBuilder()
.setName("name3373707")
.addAllDataSourceIds(newArrayList<String>())
.build();
dataTransferServiceClient.enrollDataSources(request);
}
Parameter
Name Description
request EnrollDataSourcesRequest

The request object containing all of the parameters for the API call.

enrollDataSourcesCallable()

publicfinalUnaryCallable<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(DataTransferServiceClientdataTransferServiceClient=DataTransferServiceClient.create()){
EnrollDataSourcesRequestrequest=
EnrollDataSourcesRequest.newBuilder()
.setName("name3373707")
.addAllDataSourceIds(newArrayList<String>())
.build();
ApiFuture<Empty>future=
dataTransferServiceClient.enrollDataSourcesCallable().futureCall(request);
// Do something.
future.get();
}
Returns
Type Description
UnaryCallable<EnrollDataSourcesRequest,Empty>

getDataSource(DataSourceName name)

publicfinalDataSourcegetDataSource(DataSourceNamename)

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(DataTransferServiceClientdataTransferServiceClient=DataTransferServiceClient.create()){
DataSourceNamename=
DataSourceName.ofProjectLocationDataSourceName(
"[PROJECT]","[LOCATION]","[DATA_SOURCE]");
DataSourceresponse=dataTransferServiceClient.getDataSource(name);
}
Parameter
Name Description
name DataSourceName

Required. The field will contain name of the resource requested, for example: projects/{project_id}/dataSources/{data_source_id} or projects/{project_id}/locations/{location_id}/dataSources/{data_source_id}

Returns
Type Description
DataSource

getDataSource(GetDataSourceRequest request)

publicfinalDataSourcegetDataSource(GetDataSourceRequestrequest)

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(DataTransferServiceClientdataTransferServiceClient=DataTransferServiceClient.create()){
GetDataSourceRequestrequest=
GetDataSourceRequest.newBuilder()
.setName(
DataSourceName.ofProjectLocationDataSourceName(
"[PROJECT]","[LOCATION]","[DATA_SOURCE]")
.toString())
.build();
DataSourceresponse=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)

publicfinalDataSourcegetDataSource(Stringname)

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(DataTransferServiceClientdataTransferServiceClient=DataTransferServiceClient.create()){
Stringname=DataSourceName.ofProjectDataSourceName("[PROJECT]","[DATA_SOURCE]").toString();
DataSourceresponse=dataTransferServiceClient.getDataSource(name);
}
Parameter
Name Description
name String

Required. The field will contain name of the resource requested, for example: projects/{project_id}/dataSources/{data_source_id} or projects/{project_id}/locations/{location_id}/dataSources/{data_source_id}

Returns
Type Description
DataSource

getDataSourceCallable()

publicfinalUnaryCallable<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(DataTransferServiceClientdataTransferServiceClient=DataTransferServiceClient.create()){
GetDataSourceRequestrequest=
GetDataSourceRequest.newBuilder()
.setName(
DataSourceName.ofProjectLocationDataSourceName(
"[PROJECT]","[LOCATION]","[DATA_SOURCE]")
.toString())
.build();
ApiFuture<DataSource>future=
dataTransferServiceClient.getDataSourceCallable().futureCall(request);
// Do something.
DataSourceresponse=future.get();
}
Returns
Type Description
UnaryCallable<GetDataSourceRequest,DataSource>

getLocation(GetLocationRequest request)

publicfinalLocationgetLocation(GetLocationRequestrequest)

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(DataTransferServiceClientdataTransferServiceClient=DataTransferServiceClient.create()){
GetLocationRequestrequest=GetLocationRequest.newBuilder().setName("name3373707").build();
Locationresponse=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()

publicfinalUnaryCallable<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(DataTransferServiceClientdataTransferServiceClient=DataTransferServiceClient.create()){
GetLocationRequestrequest=GetLocationRequest.newBuilder().setName("name3373707").build();
ApiFuture<Location>future=
dataTransferServiceClient.getLocationCallable().futureCall(request);
// Do something.
Locationresponse=future.get();
}
Returns
Type Description
UnaryCallable<com.google.cloud.location.GetLocationRequest,com.google.cloud.location.Location>

getSettings()

publicfinalDataTransferServiceSettingsgetSettings()
Returns
Type Description
DataTransferServiceSettings

getStub()

publicDataTransferServiceStubgetStub()
Returns
Type Description
DataTransferServiceStub

getTransferConfig(GetTransferConfigRequest request)

publicfinalTransferConfiggetTransferConfig(GetTransferConfigRequestrequest)

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(DataTransferServiceClientdataTransferServiceClient=DataTransferServiceClient.create()){
GetTransferConfigRequestrequest=
GetTransferConfigRequest.newBuilder()
.setName(
TransferConfigName.ofProjectLocationTransferConfigName(
"[PROJECT]","[LOCATION]","[TRANSFER_CONFIG]")
.toString())
.build();
TransferConfigresponse=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)

publicfinalTransferConfiggetTransferConfig(TransferConfigNamename)

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(DataTransferServiceClientdataTransferServiceClient=DataTransferServiceClient.create()){
TransferConfigNamename=
TransferConfigName.ofProjectLocationTransferConfigName(
"[PROJECT]","[LOCATION]","[TRANSFER_CONFIG]");
TransferConfigresponse=dataTransferServiceClient.getTransferConfig(name);
}
Parameter
Name Description
name TransferConfigName

Required. The field will contain name of the resource requested, for example: projects/{project_id}/transferConfigs/{config_id} or projects/{project_id}/locations/{location_id}/transferConfigs/{config_id}

Returns
Type Description
TransferConfig

getTransferConfig(String name)

publicfinalTransferConfiggetTransferConfig(Stringname)

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(DataTransferServiceClientdataTransferServiceClient=DataTransferServiceClient.create()){
Stringname=
TransferConfigName.ofProjectTransferConfigName("[PROJECT]","[TRANSFER_CONFIG]")
.toString();
TransferConfigresponse=dataTransferServiceClient.getTransferConfig(name);
}
Parameter
Name Description
name String

Required. The field will contain name of the resource requested, for example: projects/{project_id}/transferConfigs/{config_id} or projects/{project_id}/locations/{location_id}/transferConfigs/{config_id}

Returns
Type Description
TransferConfig

getTransferConfigCallable()

publicfinalUnaryCallable<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(DataTransferServiceClientdataTransferServiceClient=DataTransferServiceClient.create()){
GetTransferConfigRequestrequest=
GetTransferConfigRequest.newBuilder()
.setName(
TransferConfigName.ofProjectLocationTransferConfigName(
"[PROJECT]","[LOCATION]","[TRANSFER_CONFIG]")
.toString())
.build();
ApiFuture<TransferConfig>future=
dataTransferServiceClient.getTransferConfigCallable().futureCall(request);
// Do something.
TransferConfigresponse=future.get();
}
Returns
Type Description
UnaryCallable<GetTransferConfigRequest,TransferConfig>

getTransferRun(GetTransferRunRequest request)

publicfinalTransferRungetTransferRun(GetTransferRunRequestrequest)

Returns information about the particular 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(DataTransferServiceClientdataTransferServiceClient=DataTransferServiceClient.create()){
GetTransferRunRequestrequest=
GetTransferRunRequest.newBuilder()
.setName(
RunName.ofProjectLocationTransferConfigRunName(
"[PROJECT]","[LOCATION]","[TRANSFER_CONFIG]","[RUN]")
.toString())
.build();
TransferRunresponse=dataTransferServiceClient.getTransferRun(request);
}
Parameter
Name Description
request GetTransferRunRequest

The request object containing all of the parameters for the API call.

Returns
Type Description
TransferRun

getTransferRun(RunName name)

publicfinalTransferRungetTransferRun(RunNamename)

Returns information about the particular 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(DataTransferServiceClientdataTransferServiceClient=DataTransferServiceClient.create()){
RunNamename=
RunName.ofProjectLocationTransferConfigRunName(
"[PROJECT]","[LOCATION]","[TRANSFER_CONFIG]","[RUN]");
TransferRunresponse=dataTransferServiceClient.getTransferRun(name);
}
Parameter
Name Description
name RunName

Required. The field will contain name of the resource requested, for example: projects/{project_id}/transferConfigs/{config_id}/runs/{run_id} or projects/{project_id}/locations/{location_id}/transferConfigs/{config_id}/runs/{run_id}

Returns
Type Description
TransferRun

getTransferRun(String name)

publicfinalTransferRungetTransferRun(Stringname)

Returns information about the particular 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(DataTransferServiceClientdataTransferServiceClient=DataTransferServiceClient.create()){
Stringname=
RunName.ofProjectTransferConfigRunName("[PROJECT]","[TRANSFER_CONFIG]","[RUN]")
.toString();
TransferRunresponse=dataTransferServiceClient.getTransferRun(name);
}
Parameter
Name Description
name String

Required. The field will contain name of the resource requested, for example: projects/{project_id}/transferConfigs/{config_id}/runs/{run_id} or projects/{project_id}/locations/{location_id}/transferConfigs/{config_id}/runs/{run_id}

Returns
Type Description
TransferRun

getTransferRunCallable()

publicfinalUnaryCallable<GetTransferRunRequest,TransferRun>getTransferRunCallable()

Returns information about the particular 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(DataTransferServiceClientdataTransferServiceClient=DataTransferServiceClient.create()){
GetTransferRunRequestrequest=
GetTransferRunRequest.newBuilder()
.setName(
RunName.ofProjectLocationTransferConfigRunName(
"[PROJECT]","[LOCATION]","[TRANSFER_CONFIG]","[RUN]")
.toString())
.build();
ApiFuture<TransferRun>future=
dataTransferServiceClient.getTransferRunCallable().futureCall(request);
// Do something.
TransferRunresponse=future.get();
}
Returns
Type Description
UnaryCallable<GetTransferRunRequest,TransferRun>

isShutdown()

publicbooleanisShutdown()
Returns
Type Description
boolean

isTerminated()

publicbooleanisTerminated()
Returns
Type Description
boolean

listDataSources(ListDataSourcesRequest request)

publicfinalDataTransferServiceClient.ListDataSourcesPagedResponselistDataSources(ListDataSourcesRequestrequest)

Lists supported data sources and returns their 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(DataTransferServiceClientdataTransferServiceClient=DataTransferServiceClient.create()){
ListDataSourcesRequestrequest=
ListDataSourcesRequest.newBuilder()
.setParent(ProjectName.of("[PROJECT]").toString())
.setPageToken("pageToken873572522")
.setPageSize(883849137)
.build();
for(DataSourceelement:dataTransferServiceClient.listDataSources(request).iterateAll()){
// doThingsWith(element);
}
}
Parameter
Name Description
request ListDataSourcesRequest

The request object containing all of the parameters for the API call.

Returns
Type Description
DataTransferServiceClient.ListDataSourcesPagedResponse

listDataSources(LocationName parent)

publicfinalDataTransferServiceClient.ListDataSourcesPagedResponselistDataSources(LocationNameparent)

Lists supported data sources and returns their 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(DataTransferServiceClientdataTransferServiceClient=DataTransferServiceClient.create()){
LocationNameparent=LocationName.of("[PROJECT]","[LOCATION]");
for(DataSourceelement:dataTransferServiceClient.listDataSources(parent).iterateAll()){
// doThingsWith(element);
}
}
Parameter
Name Description
parent LocationName

Required. The BigQuery project id for which data sources should be returned. Must be in the form: projects/{project_id} or projects/{project_id}/locations/{location_id}

Returns
Type Description
DataTransferServiceClient.ListDataSourcesPagedResponse

listDataSources(ProjectName parent)

publicfinalDataTransferServiceClient.ListDataSourcesPagedResponselistDataSources(ProjectNameparent)

Lists supported data sources and returns their 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(DataTransferServiceClientdataTransferServiceClient=DataTransferServiceClient.create()){
ProjectNameparent=ProjectName.of("[PROJECT]");
for(DataSourceelement:dataTransferServiceClient.listDataSources(parent).iterateAll()){
// doThingsWith(element);
}
}
Parameter
Name Description
parent ProjectName

Required. The BigQuery project id for which data sources should be returned. Must be in the form: projects/{project_id} or projects/{project_id}/locations/{location_id}

Returns
Type Description
DataTransferServiceClient.ListDataSourcesPagedResponse

listDataSources(String parent)

publicfinalDataTransferServiceClient.ListDataSourcesPagedResponselistDataSources(Stringparent)

Lists supported data sources and returns their 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(DataTransferServiceClientdataTransferServiceClient=DataTransferServiceClient.create()){
Stringparent=ProjectName.of("[PROJECT]").toString();
for(DataSourceelement:dataTransferServiceClient.listDataSources(parent).iterateAll()){
// doThingsWith(element);
}
}
Parameter
Name Description
parent String

Required. The BigQuery project id for which data sources should be returned. Must be in the form: projects/{project_id} or projects/{project_id}/locations/{location_id}

Returns
Type Description
DataTransferServiceClient.ListDataSourcesPagedResponse

listDataSourcesCallable()

publicfinalUnaryCallable<ListDataSourcesRequest,ListDataSourcesResponse>listDataSourcesCallable()

Lists supported data sources and returns their 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(DataTransferServiceClientdataTransferServiceClient=DataTransferServiceClient.create()){
ListDataSourcesRequestrequest=
ListDataSourcesRequest.newBuilder()
.setParent(ProjectName.of("[PROJECT]").toString())
.setPageToken("pageToken873572522")
.setPageSize(883849137)
.build();
while(true){
ListDataSourcesResponseresponse=
dataTransferServiceClient.listDataSourcesCallable().call(request);
for(DataSourceelement:response.getDataSourcesList()){
// doThingsWith(element);
}
StringnextPageToken=response.getNextPageToken();
if(!Strings.isNullOrEmpty(nextPageToken)){
request=request.toBuilder().setPageToken(nextPageToken).build();
}else{
break;
}
}
}
Returns
Type Description
UnaryCallable<ListDataSourcesRequest,ListDataSourcesResponse>

listDataSourcesPagedCallable()

publicfinalUnaryCallable<ListDataSourcesRequest,DataTransferServiceClient.ListDataSourcesPagedResponse>listDataSourcesPagedCallable()

Lists supported data sources and returns their 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(DataTransferServiceClientdataTransferServiceClient=DataTransferServiceClient.create()){
ListDataSourcesRequestrequest=
ListDataSourcesRequest.newBuilder()
.setParent(ProjectName.of("[PROJECT]").toString())
.setPageToken("pageToken873572522")
.setPageSize(883849137)
.build();
ApiFuture<DataSource>future=
dataTransferServiceClient.listDataSourcesPagedCallable().futureCall(request);
// Do something.
for(DataSourceelement:future.get().iterateAll()){
// doThingsWith(element);
}
}
Returns
Type Description
UnaryCallable<ListDataSourcesRequest,ListDataSourcesPagedResponse>

listLocations(ListLocationsRequest request)

publicfinalDataTransferServiceClient.ListLocationsPagedResponselistLocations(ListLocationsRequestrequest)

Lists information about the supported locations for this service.

Sample code:


// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try(DataTransferServiceClientdataTransferServiceClient=DataTransferServiceClient.create()){
ListLocationsRequestrequest=
ListLocationsRequest.newBuilder()
.setName("name3373707")
.setFilter("filter-1274492040")
.setPageSize(883849137)
.setPageToken("pageToken873572522")
.build();
for(Locationelement:dataTransferServiceClient.listLocations(request).iterateAll()){
// doThingsWith(element);
}
}
Parameter
Name Description
request com.google.cloud.location.ListLocationsRequest

The request object containing all of the parameters for the API call.

Returns
Type Description
DataTransferServiceClient.ListLocationsPagedResponse

listLocationsCallable()

publicfinalUnaryCallable<ListLocationsRequest,ListLocationsResponse>listLocationsCallable()

Lists information about the supported locations for this service.

Sample code:


// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try(DataTransferServiceClientdataTransferServiceClient=DataTransferServiceClient.create()){
ListLocationsRequestrequest=
ListLocationsRequest.newBuilder()
.setName("name3373707")
.setFilter("filter-1274492040")
.setPageSize(883849137)
.setPageToken("pageToken873572522")
.build();
while(true){
ListLocationsResponseresponse=
dataTransferServiceClient.listLocationsCallable().call(request);
for(Locationelement:response.getLocationsList()){
// doThingsWith(element);
}
StringnextPageToken=response.getNextPageToken();
if(!Strings.isNullOrEmpty(nextPageToken)){
request=request.toBuilder().setPageToken(nextPageToken).build();
}else{
break;
}
}
}
Returns
Type Description
UnaryCallable<com.google.cloud.location.ListLocationsRequest,com.google.cloud.location.ListLocationsResponse>

listLocationsPagedCallable()

publicfinalUnaryCallable<ListLocationsRequest,DataTransferServiceClient.ListLocationsPagedResponse>listLocationsPagedCallable()

Lists information about the supported locations for this service.

Sample code:


// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try(DataTransferServiceClientdataTransferServiceClient=DataTransferServiceClient.create()){
ListLocationsRequestrequest=
ListLocationsRequest.newBuilder()
.setName("name3373707")
.setFilter("filter-1274492040")
.setPageSize(883849137)
.setPageToken("pageToken873572522")
.build();
ApiFuture<Location>future=
dataTransferServiceClient.listLocationsPagedCallable().futureCall(request);
// Do something.
for(Locationelement:future.get().iterateAll()){
// doThingsWith(element);
}
}
Returns
Type Description
UnaryCallable<com.google.cloud.location.ListLocationsRequest,ListLocationsPagedResponse>

listTransferConfigs(ListTransferConfigsRequest request)

publicfinalDataTransferServiceClient.ListTransferConfigsPagedResponselistTransferConfigs(ListTransferConfigsRequestrequest)

Returns information about all transfer configs owned by a project in the specified 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(DataTransferServiceClientdataTransferServiceClient=DataTransferServiceClient.create()){
ListTransferConfigsRequestrequest=
ListTransferConfigsRequest.newBuilder()
.setParent(ProjectName.of("[PROJECT]").toString())
.addAllDataSourceIds(newArrayList<String>())
.setPageToken("pageToken873572522")
.setPageSize(883849137)
.build();
for(TransferConfigelement:
dataTransferServiceClient.listTransferConfigs(request).iterateAll()){
// doThingsWith(element);
}
}
Parameter
Name Description
request ListTransferConfigsRequest

The request object containing all of the parameters for the API call.

Returns
Type Description
DataTransferServiceClient.ListTransferConfigsPagedResponse

listTransferConfigs(LocationName parent)

publicfinalDataTransferServiceClient.ListTransferConfigsPagedResponselistTransferConfigs(LocationNameparent)

Returns information about all transfer configs owned by a project in the specified 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(DataTransferServiceClientdataTransferServiceClient=DataTransferServiceClient.create()){
LocationNameparent=LocationName.of("[PROJECT]","[LOCATION]");
for(TransferConfigelement:
dataTransferServiceClient.listTransferConfigs(parent).iterateAll()){
// doThingsWith(element);
}
}
Parameter
Name Description
parent LocationName

Required. The BigQuery project id for which transfer configs should be returned: projects/{project_id} or projects/{project_id}/locations/{location_id}

Returns
Type Description
DataTransferServiceClient.ListTransferConfigsPagedResponse

listTransferConfigs(ProjectName parent)

publicfinalDataTransferServiceClient.ListTransferConfigsPagedResponselistTransferConfigs(ProjectNameparent)

Returns information about all transfer configs owned by a project in the specified 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(DataTransferServiceClientdataTransferServiceClient=DataTransferServiceClient.create()){
ProjectNameparent=ProjectName.of("[PROJECT]");
for(TransferConfigelement:
dataTransferServiceClient.listTransferConfigs(parent).iterateAll()){
// doThingsWith(element);
}
}
Parameter
Name Description
parent ProjectName

Required. The BigQuery project id for which transfer configs should be returned: projects/{project_id} or projects/{project_id}/locations/{location_id}

Returns
Type Description
DataTransferServiceClient.ListTransferConfigsPagedResponse

listTransferConfigs(String parent)

publicfinalDataTransferServiceClient.ListTransferConfigsPagedResponselistTransferConfigs(Stringparent)

Returns information about all transfer configs owned by a project in the specified 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(DataTransferServiceClientdataTransferServiceClient=DataTransferServiceClient.create()){
Stringparent=ProjectName.of("[PROJECT]").toString();
for(TransferConfigelement:
dataTransferServiceClient.listTransferConfigs(parent).iterateAll()){
// doThingsWith(element);
}
}
Parameter
Name Description
parent String

Required. The BigQuery project id for which transfer configs should be returned: projects/{project_id} or projects/{project_id}/locations/{location_id}

Returns
Type Description
DataTransferServiceClient.ListTransferConfigsPagedResponse

listTransferConfigsCallable()

publicfinalUnaryCallable<ListTransferConfigsRequest,ListTransferConfigsResponse>listTransferConfigsCallable()

Returns information about all transfer configs owned by a project in the specified 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(DataTransferServiceClientdataTransferServiceClient=DataTransferServiceClient.create()){
ListTransferConfigsRequestrequest=
ListTransferConfigsRequest.newBuilder()
.setParent(ProjectName.of("[PROJECT]").toString())
.addAllDataSourceIds(newArrayList<String>())
.setPageToken("pageToken873572522")
.setPageSize(883849137)
.build();
while(true){
ListTransferConfigsResponseresponse=
dataTransferServiceClient.listTransferConfigsCallable().call(request);
for(TransferConfigelement:response.getTransferConfigsList()){
// doThingsWith(element);
}
StringnextPageToken=response.getNextPageToken();
if(!Strings.isNullOrEmpty(nextPageToken)){
request=request.toBuilder().setPageToken(nextPageToken).build();
}else{
break;
}
}
}
Returns
Type Description
UnaryCallable<ListTransferConfigsRequest,ListTransferConfigsResponse>

listTransferConfigsPagedCallable()

publicfinalUnaryCallable<ListTransferConfigsRequest,DataTransferServiceClient.ListTransferConfigsPagedResponse>listTransferConfigsPagedCallable()

Returns information about all transfer configs owned by a project in the specified 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(DataTransferServiceClientdataTransferServiceClient=DataTransferServiceClient.create()){
ListTransferConfigsRequestrequest=
ListTransferConfigsRequest.newBuilder()
.setParent(ProjectName.of("[PROJECT]").toString())
.addAllDataSourceIds(newArrayList<String>())
.setPageToken("pageToken873572522")
.setPageSize(883849137)
.build();
ApiFuture<TransferConfig>future=
dataTransferServiceClient.listTransferConfigsPagedCallable().futureCall(request);
// Do something.
for(TransferConfigelement:future.get().iterateAll()){
// doThingsWith(element);
}
}
Returns
Type Description
UnaryCallable<ListTransferConfigsRequest,ListTransferConfigsPagedResponse>

listTransferLogs(ListTransferLogsRequest request)

publicfinalDataTransferServiceClient.ListTransferLogsPagedResponselistTransferLogs(ListTransferLogsRequestrequest)

Returns log messages for the 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(DataTransferServiceClientdataTransferServiceClient=DataTransferServiceClient.create()){
ListTransferLogsRequestrequest=
ListTransferLogsRequest.newBuilder()
.setParent(
RunName.ofProjectLocationTransferConfigRunName(
"[PROJECT]","[LOCATION]","[TRANSFER_CONFIG]","[RUN]")
.toString())
.setPageToken("pageToken873572522")
.setPageSize(883849137)
.addAllMessageTypes(newArrayList<TransferMessage.MessageSeverity>())
.build();
for(TransferMessageelement:
dataTransferServiceClient.listTransferLogs(request).iterateAll()){
// doThingsWith(element);
}
}
Parameter
Name Description
request ListTransferLogsRequest

The request object containing all of the parameters for the API call.

Returns
Type Description
DataTransferServiceClient.ListTransferLogsPagedResponse

listTransferLogs(RunName parent)

publicfinalDataTransferServiceClient.ListTransferLogsPagedResponselistTransferLogs(RunNameparent)

Returns log messages for the 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(DataTransferServiceClientdataTransferServiceClient=DataTransferServiceClient.create()){
RunNameparent=
RunName.ofProjectLocationTransferConfigRunName(
"[PROJECT]","[LOCATION]","[TRANSFER_CONFIG]","[RUN]");
for(TransferMessageelement:
dataTransferServiceClient.listTransferLogs(parent).iterateAll()){
// doThingsWith(element);
}
}
Parameter
Name Description
parent RunName

Required. Transfer run name in the form: projects/{project_id}/transferConfigs/{config_id}/runs/{run_id} or projects/{project_id}/locations/{location_id}/transferConfigs/{config_id}/runs/{run_id}

Returns
Type Description
DataTransferServiceClient.ListTransferLogsPagedResponse

listTransferLogs(String parent)

publicfinalDataTransferServiceClient.ListTransferLogsPagedResponselistTransferLogs(Stringparent)

Returns log messages for the 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(DataTransferServiceClientdataTransferServiceClient=DataTransferServiceClient.create()){
Stringparent=
RunName.ofProjectTransferConfigRunName("[PROJECT]","[TRANSFER_CONFIG]","[RUN]")
.toString();
for(TransferMessageelement:
dataTransferServiceClient.listTransferLogs(parent).iterateAll()){
// doThingsWith(element);
}
}
Parameter
Name Description
parent String

Required. Transfer run name in the form: projects/{project_id}/transferConfigs/{config_id}/runs/{run_id} or projects/{project_id}/locations/{location_id}/transferConfigs/{config_id}/runs/{run_id}

Returns
Type Description
DataTransferServiceClient.ListTransferLogsPagedResponse

listTransferLogsCallable()

publicfinalUnaryCallable<ListTransferLogsRequest,ListTransferLogsResponse>listTransferLogsCallable()

Returns log messages for the 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(DataTransferServiceClientdataTransferServiceClient=DataTransferServiceClient.create()){
ListTransferLogsRequestrequest=
ListTransferLogsRequest.newBuilder()
.setParent(
RunName.ofProjectLocationTransferConfigRunName(
"[PROJECT]","[LOCATION]","[TRANSFER_CONFIG]","[RUN]")
.toString())
.setPageToken("pageToken873572522")
.setPageSize(883849137)
.addAllMessageTypes(newArrayList<TransferMessage.MessageSeverity>())
.build();
while(true){
ListTransferLogsResponseresponse=
dataTransferServiceClient.listTransferLogsCallable().call(request);
for(TransferMessageelement:response.getTransferMessagesList()){
// doThingsWith(element);
}
StringnextPageToken=response.getNextPageToken();
if(!Strings.isNullOrEmpty(nextPageToken)){
request=request.toBuilder().setPageToken(nextPageToken).build();
}else{
break;
}
}
}
Returns
Type Description
UnaryCallable<ListTransferLogsRequest,ListTransferLogsResponse>

listTransferLogsPagedCallable()

publicfinalUnaryCallable<ListTransferLogsRequest,DataTransferServiceClient.ListTransferLogsPagedResponse>listTransferLogsPagedCallable()

Returns log messages for the 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(DataTransferServiceClientdataTransferServiceClient=DataTransferServiceClient.create()){
ListTransferLogsRequestrequest=
ListTransferLogsRequest.newBuilder()
.setParent(
RunName.ofProjectLocationTransferConfigRunName(
"[PROJECT]","[LOCATION]","[TRANSFER_CONFIG]","[RUN]")
.toString())
.setPageToken("pageToken873572522")
.setPageSize(883849137)
.addAllMessageTypes(newArrayList<TransferMessage.MessageSeverity>())
.build();
ApiFuture<TransferMessage>future=
dataTransferServiceClient.listTransferLogsPagedCallable().futureCall(request);
// Do something.
for(TransferMessageelement:future.get().iterateAll()){
// doThingsWith(element);
}
}
Returns
Type Description
UnaryCallable<ListTransferLogsRequest,ListTransferLogsPagedResponse>

listTransferRuns(ListTransferRunsRequest request)

publicfinalDataTransferServiceClient.ListTransferRunsPagedResponselistTransferRuns(ListTransferRunsRequestrequest)

Returns information about running and completed transfer runs.

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(DataTransferServiceClientdataTransferServiceClient=DataTransferServiceClient.create()){
ListTransferRunsRequestrequest=
ListTransferRunsRequest.newBuilder()
.setParent(
TransferConfigName.ofProjectLocationTransferConfigName(
"[PROJECT]","[LOCATION]","[TRANSFER_CONFIG]")
.toString())
.addAllStates(newArrayList<TransferState>())
.setPageToken("pageToken873572522")
.setPageSize(883849137)
.build();
for(TransferRunelement:dataTransferServiceClient.listTransferRuns(request).iterateAll()){
// doThingsWith(element);
}
}
Parameter
Name Description
request ListTransferRunsRequest

The request object containing all of the parameters for the API call.

Returns
Type Description
DataTransferServiceClient.ListTransferRunsPagedResponse

listTransferRuns(TransferConfigName parent)

publicfinalDataTransferServiceClient.ListTransferRunsPagedResponselistTransferRuns(TransferConfigNameparent)

Returns information about running and completed transfer runs.

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(DataTransferServiceClientdataTransferServiceClient=DataTransferServiceClient.create()){
TransferConfigNameparent=
TransferConfigName.ofProjectLocationTransferConfigName(
"[PROJECT]","[LOCATION]","[TRANSFER_CONFIG]");
for(TransferRunelement:dataTransferServiceClient.listTransferRuns(parent).iterateAll()){
// doThingsWith(element);
}
}
Parameter
Name Description
parent TransferConfigName

Required. Name of transfer configuration for which transfer runs should be retrieved. Format of transfer configuration resource name is: projects/{project_id}/transferConfigs/{config_id} or projects/{project_id}/locations/{location_id}/transferConfigs/{config_id}.

Returns
Type Description
DataTransferServiceClient.ListTransferRunsPagedResponse

listTransferRuns(String parent)

publicfinalDataTransferServiceClient.ListTransferRunsPagedResponselistTransferRuns(Stringparent)

Returns information about running and completed transfer runs.

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(DataTransferServiceClientdataTransferServiceClient=DataTransferServiceClient.create()){
Stringparent=
TransferConfigName.ofProjectTransferConfigName("[PROJECT]","[TRANSFER_CONFIG]")
.toString();
for(TransferRunelement:dataTransferServiceClient.listTransferRuns(parent).iterateAll()){
// doThingsWith(element);
}
}
Parameter
Name Description
parent String

Required. Name of transfer configuration for which transfer runs should be retrieved. Format of transfer configuration resource name is: projects/{project_id}/transferConfigs/{config_id} or projects/{project_id}/locations/{location_id}/transferConfigs/{config_id}.

Returns
Type Description
DataTransferServiceClient.ListTransferRunsPagedResponse

listTransferRunsCallable()

publicfinalUnaryCallable<ListTransferRunsRequest,ListTransferRunsResponse>listTransferRunsCallable()

Returns information about running and completed transfer runs.

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(DataTransferServiceClientdataTransferServiceClient=DataTransferServiceClient.create()){
ListTransferRunsRequestrequest=
ListTransferRunsRequest.newBuilder()
.setParent(
TransferConfigName.ofProjectLocationTransferConfigName(
"[PROJECT]","[LOCATION]","[TRANSFER_CONFIG]")
.toString())
.addAllStates(newArrayList<TransferState>())
.setPageToken("pageToken873572522")
.setPageSize(883849137)
.build();
while(true){
ListTransferRunsResponseresponse=
dataTransferServiceClient.listTransferRunsCallable().call(request);
for(TransferRunelement:response.getTransferRunsList()){
// doThingsWith(element);
}
StringnextPageToken=response.getNextPageToken();
if(!Strings.isNullOrEmpty(nextPageToken)){
request=request.toBuilder().setPageToken(nextPageToken).build();
}else{
break;
}
}
}
Returns
Type Description
UnaryCallable<ListTransferRunsRequest,ListTransferRunsResponse>

listTransferRunsPagedCallable()

publicfinalUnaryCallable<ListTransferRunsRequest,DataTransferServiceClient.ListTransferRunsPagedResponse>listTransferRunsPagedCallable()

Returns information about running and completed transfer runs.

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(DataTransferServiceClientdataTransferServiceClient=DataTransferServiceClient.create()){
ListTransferRunsRequestrequest=
ListTransferRunsRequest.newBuilder()
.setParent(
TransferConfigName.ofProjectLocationTransferConfigName(
"[PROJECT]","[LOCATION]","[TRANSFER_CONFIG]")
.toString())
.addAllStates(newArrayList<TransferState>())
.setPageToken("pageToken873572522")
.setPageSize(883849137)
.build();
ApiFuture<TransferRun>future=
dataTransferServiceClient.listTransferRunsPagedCallable().futureCall(request);
// Do something.
for(TransferRunelement:future.get().iterateAll()){
// doThingsWith(element);
}
}
Returns
Type Description
UnaryCallable<ListTransferRunsRequest,ListTransferRunsPagedResponse>

scheduleTransferRuns(ScheduleTransferRunsRequest request) (deprecated)

publicfinalScheduleTransferRunsResponsescheduleTransferRuns(ScheduleTransferRunsRequestrequest)

Deprecated. This method is deprecated and will be removed in the next major version update.

Creates transfer runs for a time range [start_time, end_time]. For each date - or whatever granularity the data source supports - in the range, one transfer run is created. Note that runs are created per UTC time in the time range. DEPRECATED: use StartManualTransferRuns instead.

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(DataTransferServiceClientdataTransferServiceClient=DataTransferServiceClient.create()){
ScheduleTransferRunsRequestrequest=
ScheduleTransferRunsRequest.newBuilder()
.setParent(
TransferConfigName.ofProjectLocationTransferConfigName(
"[PROJECT]","[LOCATION]","[TRANSFER_CONFIG]")
.toString())
.setStartTime(Timestamp.newBuilder().build())
.setEndTime(Timestamp.newBuilder().build())
.build();
ScheduleTransferRunsResponseresponse=
dataTransferServiceClient.scheduleTransferRuns(request);
}
Parameter
Name Description
request ScheduleTransferRunsRequest

The request object containing all of the parameters for the API call.

Returns
Type Description
ScheduleTransferRunsResponse

scheduleTransferRuns(TransferConfigName parent, Timestamp startTime, Timestamp endTime) (deprecated)

publicfinalScheduleTransferRunsResponsescheduleTransferRuns(TransferConfigNameparent,TimestampstartTime,TimestampendTime)

Deprecated. This method is deprecated and will be removed in the next major version update.

Creates transfer runs for a time range [start_time, end_time]. For each date - or whatever granularity the data source supports - in the range, one transfer run is created. Note that runs are created per UTC time in the time range. DEPRECATED: use StartManualTransferRuns instead.

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(DataTransferServiceClientdataTransferServiceClient=DataTransferServiceClient.create()){
TransferConfigNameparent=
TransferConfigName.ofProjectLocationTransferConfigName(
"[PROJECT]","[LOCATION]","[TRANSFER_CONFIG]");
TimestampstartTime=Timestamp.newBuilder().build();
TimestampendTime=Timestamp.newBuilder().build();
ScheduleTransferRunsResponseresponse=
dataTransferServiceClient.scheduleTransferRuns(parent,startTime,endTime);
}
Parameters
Name Description
parent TransferConfigName

Required. Transfer configuration name in the form: projects/{project_id}/transferConfigs/{config_id} or projects/{project_id}/locations/{location_id}/transferConfigs/{config_id}.

startTime Timestamp

Required. Start time of the range of transfer runs. For example, "2017年05月25日T00:00:00+00:00".

endTime Timestamp

Required. End time of the range of transfer runs. For example, "2017年05月30日T00:00:00+00:00".

Returns
Type Description
ScheduleTransferRunsResponse

scheduleTransferRuns(String parent, Timestamp startTime, Timestamp endTime) (deprecated)

publicfinalScheduleTransferRunsResponsescheduleTransferRuns(Stringparent,TimestampstartTime,TimestampendTime)

Deprecated. This method is deprecated and will be removed in the next major version update.

Creates transfer runs for a time range [start_time, end_time]. For each date - or whatever granularity the data source supports - in the range, one transfer run is created. Note that runs are created per UTC time in the time range. DEPRECATED: use StartManualTransferRuns instead.

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(DataTransferServiceClientdataTransferServiceClient=DataTransferServiceClient.create()){
Stringparent=
TransferConfigName.ofProjectTransferConfigName("[PROJECT]","[TRANSFER_CONFIG]")
.toString();
TimestampstartTime=Timestamp.newBuilder().build();
TimestampendTime=Timestamp.newBuilder().build();
ScheduleTransferRunsResponseresponse=
dataTransferServiceClient.scheduleTransferRuns(parent,startTime,endTime);
}
Parameters
Name Description
parent String

Required. Transfer configuration name in the form: projects/{project_id}/transferConfigs/{config_id} or projects/{project_id}/locations/{location_id}/transferConfigs/{config_id}.

startTime Timestamp

Required. Start time of the range of transfer runs. For example, "2017年05月25日T00:00:00+00:00".

endTime Timestamp

Required. End time of the range of transfer runs. For example, "2017年05月30日T00:00:00+00:00".

Returns
Type Description
ScheduleTransferRunsResponse

scheduleTransferRunsCallable() (deprecated)

publicfinalUnaryCallable<ScheduleTransferRunsRequest,ScheduleTransferRunsResponse>scheduleTransferRunsCallable()

Deprecated. This method is deprecated and will be removed in the next major version update.

Creates transfer runs for a time range [start_time, end_time]. For each date - or whatever granularity the data source supports - in the range, one transfer run is created. Note that runs are created per UTC time in the time range. DEPRECATED: use StartManualTransferRuns instead.

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(DataTransferServiceClientdataTransferServiceClient=DataTransferServiceClient.create()){
ScheduleTransferRunsRequestrequest=
ScheduleTransferRunsRequest.newBuilder()
.setParent(
TransferConfigName.ofProjectLocationTransferConfigName(
"[PROJECT]","[LOCATION]","[TRANSFER_CONFIG]")
.toString())
.setStartTime(Timestamp.newBuilder().build())
.setEndTime(Timestamp.newBuilder().build())
.build();
ApiFuture<ScheduleTransferRunsResponse>future=
dataTransferServiceClient.scheduleTransferRunsCallable().futureCall(request);
// Do something.
ScheduleTransferRunsResponseresponse=future.get();
}
Returns
Type Description
UnaryCallable<ScheduleTransferRunsRequest,ScheduleTransferRunsResponse>

shutdown()

publicvoidshutdown()

shutdownNow()

publicvoidshutdownNow()

startManualTransferRuns(StartManualTransferRunsRequest request)

publicfinalStartManualTransferRunsResponsestartManualTransferRuns(StartManualTransferRunsRequestrequest)

Start manual transfer runs to be executed now with schedule_time equal to current time. The transfer runs can be created for a time range where the run_time is between start_time (inclusive) and end_time (exclusive), or for a specific run_time.

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(DataTransferServiceClientdataTransferServiceClient=DataTransferServiceClient.create()){
StartManualTransferRunsRequestrequest=
StartManualTransferRunsRequest.newBuilder()
.setParent(
TransferConfigName.ofProjectLocationTransferConfigName(
"[PROJECT]","[LOCATION]","[TRANSFER_CONFIG]")
.toString())
.build();
StartManualTransferRunsResponseresponse=
dataTransferServiceClient.startManualTransferRuns(request);
}
Parameter
Name Description
request StartManualTransferRunsRequest

The request object containing all of the parameters for the API call.

Returns
Type Description
StartManualTransferRunsResponse

startManualTransferRunsCallable()

publicfinalUnaryCallable<StartManualTransferRunsRequest,StartManualTransferRunsResponse>startManualTransferRunsCallable()

Start manual transfer runs to be executed now with schedule_time equal to current time. The transfer runs can be created for a time range where the run_time is between start_time (inclusive) and end_time (exclusive), or for a specific run_time.

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(DataTransferServiceClientdataTransferServiceClient=DataTransferServiceClient.create()){
StartManualTransferRunsRequestrequest=
StartManualTransferRunsRequest.newBuilder()
.setParent(
TransferConfigName.ofProjectLocationTransferConfigName(
"[PROJECT]","[LOCATION]","[TRANSFER_CONFIG]")
.toString())
.build();
ApiFuture<StartManualTransferRunsResponse>future=
dataTransferServiceClient.startManualTransferRunsCallable().futureCall(request);
// Do something.
StartManualTransferRunsResponseresponse=future.get();
}
Returns
Type Description
UnaryCallable<StartManualTransferRunsRequest,StartManualTransferRunsResponse>

unenrollDataSources(UnenrollDataSourcesRequest request)

publicfinalvoidunenrollDataSources(UnenrollDataSourcesRequestrequest)

Unenroll data sources in a user project. This allows users to remove transfer configurations for these data sources. They will no longer appear in the ListDataSources RPC and will also no longer appear in the BigQuery UI. Data transfers configurations of unenrolled data sources will not be scheduled.

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(DataTransferServiceClientdataTransferServiceClient=DataTransferServiceClient.create()){
UnenrollDataSourcesRequestrequest=
UnenrollDataSourcesRequest.newBuilder()
.setName("name3373707")
.addAllDataSourceIds(newArrayList<String>())
.build();
dataTransferServiceClient.unenrollDataSources(request);
}
Parameter
Name Description
request UnenrollDataSourcesRequest

The request object containing all of the parameters for the API call.

unenrollDataSourcesCallable()

publicfinalUnaryCallable<UnenrollDataSourcesRequest,Empty>unenrollDataSourcesCallable()

Unenroll data sources in a user project. This allows users to remove transfer configurations for these data sources. They will no longer appear in the ListDataSources RPC and will also no longer appear in the BigQuery UI. Data transfers configurations of unenrolled data sources will not be scheduled.

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(DataTransferServiceClientdataTransferServiceClient=DataTransferServiceClient.create()){
UnenrollDataSourcesRequestrequest=
UnenrollDataSourcesRequest.newBuilder()
.setName("name3373707")
.addAllDataSourceIds(newArrayList<String>())
.build();
ApiFuture<Empty>future=
dataTransferServiceClient.unenrollDataSourcesCallable().futureCall(request);
// Do something.
future.get();
}
Returns
Type Description
UnaryCallable<UnenrollDataSourcesRequest,Empty>

updateTransferConfig(TransferConfig transferConfig, FieldMask updateMask)

publicfinalTransferConfigupdateTransferConfig(TransferConfigtransferConfig,FieldMaskupdateMask)

Updates a data transfer configuration. All fields must be set, even if they are not updated.

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(DataTransferServiceClientdataTransferServiceClient=DataTransferServiceClient.create()){
TransferConfigtransferConfig=TransferConfig.newBuilder().build();
FieldMaskupdateMask=FieldMask.newBuilder().build();
TransferConfigresponse=
dataTransferServiceClient.updateTransferConfig(transferConfig,updateMask);
}
Parameters
Name Description
transferConfig TransferConfig

Required. Data transfer configuration to create.

updateMask FieldMask

Required. Required list of fields to be updated in this request.

Returns
Type Description
TransferConfig

updateTransferConfig(UpdateTransferConfigRequest request)

publicfinalTransferConfigupdateTransferConfig(UpdateTransferConfigRequestrequest)

Updates a data transfer configuration. All fields must be set, even if they are not updated.

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(DataTransferServiceClientdataTransferServiceClient=DataTransferServiceClient.create()){
UpdateTransferConfigRequestrequest=
UpdateTransferConfigRequest.newBuilder()
.setTransferConfig(TransferConfig.newBuilder().build())
.setAuthorizationCode("authorizationCode742596102")
.setUpdateMask(FieldMask.newBuilder().build())
.setVersionInfo("versionInfo688769446")
.setServiceAccountName("serviceAccountName2137368675")
.build();
TransferConfigresponse=dataTransferServiceClient.updateTransferConfig(request);
}
Parameter
Name Description
request UpdateTransferConfigRequest

The request object containing all of the parameters for the API call.

Returns
Type Description
TransferConfig

updateTransferConfigCallable()

publicfinalUnaryCallable<UpdateTransferConfigRequest,TransferConfig>updateTransferConfigCallable()

Updates a data transfer configuration. All fields must be set, even if they are not updated.

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(DataTransferServiceClientdataTransferServiceClient=DataTransferServiceClient.create()){
UpdateTransferConfigRequestrequest=
UpdateTransferConfigRequest.newBuilder()
.setTransferConfig(TransferConfig.newBuilder().build())
.setAuthorizationCode("authorizationCode742596102")
.setUpdateMask(FieldMask.newBuilder().build())
.setVersionInfo("versionInfo688769446")
.setServiceAccountName("serviceAccountName2137368675")
.build();
ApiFuture<TransferConfig>future=
dataTransferServiceClient.updateTransferConfigCallable().futureCall(request);
// Do something.
TransferConfigresponse=future.get();
}
Returns
Type Description
UnaryCallable<UpdateTransferConfigRequest,TransferConfig>

Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License, and code samples are licensed under the Apache 2.0 License. For details, see the Google Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.

Last updated 2025年10月30日 UTC.