v1. DataTransferServiceClient
Source: v1/
The Google BigQuery Data Transfer Service API enables BigQuery users to configure the transfer of their data from other Google Products into BigQuery. This service contains methods that are end user exposed. It backs up the frontend.
Properties
Methods
- checkValidCreds(request[, options][, callback])
- createTransferConfig(request[, options][, callback])
- deleteTransferConfig(request[, options][, callback])
- deleteTransferRun(request[, options][, callback])
- enableDataTransferService(request[, options][, callback])
- getDataSource(request[, options][, callback])
- getProjectId(callback)
- getTransferConfig(request[, options][, callback])
- getTransferRun(request[, options][, callback])
- isDataTransferServiceEnabled(request[, options][, callback])
- listDataSources(request[, options][, callback])
- listDataSourcesStream(request[, options])
- listTransferConfigs(request[, options][, callback])
- listTransferConfigsStream(request[, options])
- listTransferLogs(request[, options][, callback])
- listTransferLogsStream(request[, options])
- listTransferRuns(request[, options][, callback])
- listTransferRunsStream(request[, options])
- matchDataSourceFromProjectDataSourceName(projectDataSourceName)
- matchProjectFromProjectDataSourceName(projectDataSourceName)
- matchProjectFromProjectName(projectName)
- matchProjectFromProjectRunName(projectRunName)
- matchProjectFromProjectTransferConfigName(projectTransferConfigName)
- matchRunFromProjectRunName(projectRunName)
- matchTransferConfigFromProjectRunName(projectRunName)
- matchTransferConfigFromProjectTransferConfigName(projectTransferConfigName)
- projectDataSourcePath(project, dataSource)
- projectPath(project)
- projectRunPath(project, transferConfig, run)
- projectTransferConfigPath(project, transferConfig)
- scheduleTransferRuns(request[, options][, callback])
- startManualTransferRuns(request[, options][, callback])
- updateTransferConfig(request[, options][, callback])
new DataTransferServiceClient([options])
Construct an instance of DataTransferServiceClient.
Parameters
| Name | Type | Optional | Description | ||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
options |
|
Yes |
The configuration object. See the subsequent parameters for more details. Values in
|
Properties
apiEndpoint
The DNS address for this API service - same as servicePath(), exists for compatibility reasons.
port
The port for this API service.
scopes
The scopes needed to make gRPC calls for every method defined in this service.
servicePath
The DNS address for this API service.
Methods
checkValidCreds(request[, options][, callback]) → Promise
Returns true if valid credentials exist for the given data source and requesting user. Some data sources doesn't support service account, so we need to talk to them on behalf of the end user. This API just checks whether we have OAuth token for the particular user, which is a pre-requisite before user can create a transfer config.
Example
const bigqueryDataTransfer = require('@google-cloud/bigquery-data-transfer');
const client = new bigqueryDataTransfer.v1.DataTransferServiceClient({
// optional auth parameters.
});
const formattedName = client.projectDataSourcePath('[PROJECT]', '[DATA_SOURCE]');
client.checkValidCreds({name: formattedName})
.then(responses => {
const response = responses[0];
// doThingsWith(response)
})
.catch(err => {
console.error(err);
});
Parameters
| Name | Type | Optional | Description | ||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|
|
request |
Object |
|
The request object that will be sent. Values in
|
||||||||
|
options |
Object |
Yes |
Optional parameters. You can override the default settings for this call, e.g, timeout, retries, paginations, etc. See gax.CallOptions for the details. |
||||||||
|
callback |
function(nullable Error, nullable Object) |
Yes |
The function which will be called with the result of the API call. The second parameter to the callback is an object representing CheckValidCredsResponse. |
- Returns
Promise- The promise which resolves to an array. The first element of the array is an object representing CheckValidCredsResponse. The promise has a method named "cancel" which cancels the ongoing API call.
createTransferConfig(request[, options][, callback]) → Promise
Creates a new data transfer configuration.
Example
const bigqueryDataTransfer = require('@google-cloud/bigquery-data-transfer');
const client = new bigqueryDataTransfer.v1.DataTransferServiceClient({
// optional auth parameters.
});
const formattedParent = client.projectPath('[PROJECT]');
const transferConfig = {};
const request = {
parent: formattedParent,
transferConfig: transferConfig,
};
client.createTransferConfig(request)
.then(responses => {
const response = responses[0];
// doThingsWith(response)
})
.catch(err => {
console.error(err);
});
Parameters
| Name | Type | Optional | Description | ||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
request |
Object |
|
The request object that will be sent. Values in
|
||||||||||||||||||||
|
options |
Object |
Yes |
Optional parameters. You can override the default settings for this call, e.g, timeout, retries, paginations, etc. See gax.CallOptions for the details. |
||||||||||||||||||||
|
callback |
function(nullable Error, nullable Object) |
Yes |
The function which will be called with the result of the API call. The second parameter to the callback is an object representing TransferConfig. |
- Returns
Promise- The promise which resolves to an array. The first element of the array is an object representing TransferConfig. The promise has a method named "cancel" which cancels the ongoing API call.
deleteTransferConfig(request[, options][, callback]) → Promise
Deletes a data transfer configuration, including any associated transfer runs and logs.
Example
const bigqueryDataTransfer = require('@google-cloud/bigquery-data-transfer');
const client = new bigqueryDataTransfer.v1.DataTransferServiceClient({
// optional auth parameters.
});
const formattedName = client.projectTransferConfigPath('[PROJECT]', '[TRANSFER_CONFIG]');
client.deleteTransferConfig({name: formattedName}).catch(err => {
console.error(err);
});
Parameters
| Name | Type | Optional | Description | ||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|
|
request |
Object |
|
The request object that will be sent. Values in
|
||||||||
|
options |
Object |
Yes |
Optional parameters. You can override the default settings for this call, e.g, timeout, retries, paginations, etc. See gax.CallOptions for the details. |
||||||||
|
callback |
function(nullable Error) |
Yes |
The function which will be called with the result of the API call. |
- Returns
Promise- The promise which resolves when API call finishes. The promise has a method named "cancel" which cancels the ongoing API call.
deleteTransferRun(request[, options][, callback]) → Promise
Deletes the specified transfer run.
Example
const bigqueryDataTransfer = require('@google-cloud/bigquery-data-transfer');
const client = new bigqueryDataTransfer.v1.DataTransferServiceClient({
// optional auth parameters.
});
const formattedName = client.projectRunPath('[PROJECT]', '[TRANSFER_CONFIG]', '[RUN]');
client.deleteTransferRun({name: formattedName}).catch(err => {
console.error(err);
});
Parameters
| Name | Type | Optional | Description | ||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|
|
request |
Object |
|
The request object that will be sent. Values in
|
||||||||
|
options |
Object |
Yes |
Optional parameters. You can override the default settings for this call, e.g, timeout, retries, paginations, etc. See gax.CallOptions for the details. |
||||||||
|
callback |
function(nullable Error) |
Yes |
The function which will be called with the result of the API call. |
- Returns
Promise- The promise which resolves when API call finishes. The promise has a method named "cancel" which cancels the ongoing API call.
enableDataTransferService(request[, options][, callback]) → Promise
Enables data transfer service for a given project. This method requires the additional scope of 'https://www.googleapis.com/auth/cloudplatformprojects' to manage the cloud project permissions.
Example
const bigqueryDataTransfer = require('@google-cloud/bigquery-data-transfer');
const client = new bigqueryDataTransfer.v1.DataTransferServiceClient({
// optional auth parameters.
});
client.enableDataTransferService({}).catch(err => {
console.error(err);
});
Parameters
| Name | Type | Optional | Description | ||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|
|
request |
Object |
|
The request object that will be sent. Values in
|
||||||||
|
options |
Object |
Yes |
Optional parameters. You can override the default settings for this call, e.g, timeout, retries, paginations, etc. See gax.CallOptions for the details. |
||||||||
|
callback |
function(nullable Error) |
Yes |
The function which will be called with the result of the API call. |
- Returns
Promise- The promise which resolves when API call finishes. The promise has a method named "cancel" which cancels the ongoing API call.
getDataSource(request[, options][, callback]) → Promise
Retrieves a supported data source and returns its settings, which can be used for UI rendering.
Example
const bigqueryDataTransfer = require('@google-cloud/bigquery-data-transfer');
const client = new bigqueryDataTransfer.v1.DataTransferServiceClient({
// optional auth parameters.
});
const formattedName = client.projectDataSourcePath('[PROJECT]', '[DATA_SOURCE]');
client.getDataSource({name: formattedName})
.then(responses => {
const response = responses[0];
// doThingsWith(response)
})
.catch(err => {
console.error(err);
});
Parameters
| Name | Type | Optional | Description | ||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|
|
request |
Object |
|
The request object that will be sent. Values in
|
||||||||
|
options |
Object |
Yes |
Optional parameters. You can override the default settings for this call, e.g, timeout, retries, paginations, etc. See gax.CallOptions for the details. |
||||||||
|
callback |
function(nullable Error, nullable Object) |
Yes |
The function which will be called with the result of the API call. The second parameter to the callback is an object representing DataSource. |
- Returns
Promise- The promise which resolves to an array. The first element of the array is an object representing DataSource. The promise has a method named "cancel" which cancels the ongoing API call.
getProjectId(callback)
Return the project ID used by this class.
Parameter
| Name | Type | Optional | Description |
|---|---|---|---|
|
callback |
function(Error, string) |
|
the callback to be called with the current project Id. |
getTransferConfig(request[, options][, callback]) → Promise
Returns information about a data transfer config.
Example
const bigqueryDataTransfer = require('@google-cloud/bigquery-data-transfer');
const client = new bigqueryDataTransfer.v1.DataTransferServiceClient({
// optional auth parameters.
});
const formattedName = client.projectTransferConfigPath('[PROJECT]', '[TRANSFER_CONFIG]');
client.getTransferConfig({name: formattedName})
.then(responses => {
const response = responses[0];
// doThingsWith(response)
})
.catch(err => {
console.error(err);
});
Parameters
| Name | Type | Optional | Description | ||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|
|
request |
Object |
|
The request object that will be sent. Values in
|
||||||||
|
options |
Object |
Yes |
Optional parameters. You can override the default settings for this call, e.g, timeout, retries, paginations, etc. See gax.CallOptions for the details. |
||||||||
|
callback |
function(nullable Error, nullable Object) |
Yes |
The function which will be called with the result of the API call. The second parameter to the callback is an object representing TransferConfig. |
- Returns
Promise- The promise which resolves to an array. The first element of the array is an object representing TransferConfig. The promise has a method named "cancel" which cancels the ongoing API call.
getTransferRun(request[, options][, callback]) → Promise
Returns information about the particular transfer run.
Example
const bigqueryDataTransfer = require('@google-cloud/bigquery-data-transfer');
const client = new bigqueryDataTransfer.v1.DataTransferServiceClient({
// optional auth parameters.
});
const formattedName = client.projectRunPath('[PROJECT]', '[TRANSFER_CONFIG]', '[RUN]');
client.getTransferRun({name: formattedName})
.then(responses => {
const response = responses[0];
// doThingsWith(response)
})
.catch(err => {
console.error(err);
});
Parameters
| Name | Type | Optional | Description | ||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|
|
request |
Object |
|
The request object that will be sent. Values in
|
||||||||
|
options |
Object |
Yes |
Optional parameters. You can override the default settings for this call, e.g, timeout, retries, paginations, etc. See gax.CallOptions for the details. |
||||||||
|
callback |
function(nullable Error, nullable Object) |
Yes |
The function which will be called with the result of the API call. The second parameter to the callback is an object representing TransferRun. |
- Returns
Promise- The promise which resolves to an array. The first element of the array is an object representing TransferRun. The promise has a method named "cancel" which cancels the ongoing API call.
isDataTransferServiceEnabled(request[, options][, callback]) → Promise
Returns true if data transfer is enabled for a project.
Example
const bigqueryDataTransfer = require('@google-cloud/bigquery-data-transfer');
const client = new bigqueryDataTransfer.v1.DataTransferServiceClient({
// optional auth parameters.
});
client.isDataTransferServiceEnabled({})
.then(responses => {
const response = responses[0];
// doThingsWith(response)
})
.catch(err => {
console.error(err);
});
Parameters
| Name | Type | Optional | Description | ||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|
|
request |
Object |
|
The request object that will be sent. Values in
|
||||||||
|
options |
Object |
Yes |
Optional parameters. You can override the default settings for this call, e.g, timeout, retries, paginations, etc. See gax.CallOptions for the details. |
||||||||
|
callback |
function(nullable Error, nullable Object) |
Yes |
The function which will be called with the result of the API call. The second parameter to the callback is an object representing IsDataTransferServiceEnabledResponse. |
- Returns
Promise- The promise which resolves to an array. The first element of the array is an object representing IsDataTransferServiceEnabledResponse. The promise has a method named "cancel" which cancels the ongoing API call.
listDataSources(request[, options][, callback]) → Promise
Lists supported data sources and returns their settings, which can be used for UI rendering.
Example
const bigqueryDataTransfer = require('@google-cloud/bigquery-data-transfer');
const client = new bigqueryDataTransfer.v1.DataTransferServiceClient({
// optional auth parameters.
});
// Iterate over all elements.
const formattedParent = client.projectPath('[PROJECT]');
client.listDataSources({parent: formattedParent})
.then(responses => {
const resources = responses[0];
for (const resource of resources) {
// doThingsWith(resource)
}
})
.catch(err => {
console.error(err);
});
// Or obtain the paged response.
const formattedParent = client.projectPath('[PROJECT]');
const options = {autoPaginate: false};
const callback = responses => {
// The actual resources in a response.
const resources = responses[0];
// The next request if the response shows that there are more responses.
const nextRequest = responses[1];
// The actual response object, if necessary.
// const rawResponse = responses[2];
for (const resource of resources) {
// doThingsWith(resource);
}
if (nextRequest) {
// Fetch the next page.
return client.listDataSources(nextRequest, options).then(callback);
}
}
client.listDataSources({parent: formattedParent}, options)
.then(callback)
.catch(err => {
console.error(err);
});
Parameters
| Name | Type | Optional | Description | ||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
request |
Object |
|
The request object that will be sent. Values in
|
||||||||||||
|
options |
Object |
Yes |
Optional parameters. You can override the default settings for this call, e.g, timeout, retries, paginations, etc. See gax.CallOptions for the details. |
||||||||||||
|
callback |
function(nullable Error, nullable Array, nullable Object, nullable Object) |
Yes |
The function which will be called with the result of the API call. The second parameter to the callback is Array of DataSource. When autoPaginate: false is specified through options, it contains the result in a single response. If the response indicates the next page exists, the third parameter is set to be used for the next request object. The fourth parameter keeps the raw response object of an object representing ListDataSourcesResponse. |
- Returns
Promise-
The promise which resolves to an array. The first element of the array is Array of DataSource.
When autoPaginate: false is specified through options, the array has three elements. The first element is Array of DataSource in a single response. The second element is the next request object if the response indicates the next page exists, or null. The third element is an object representing ListDataSourcesResponse.
The promise has a method named "cancel" which cancels the ongoing API call.
-
listDataSourcesStream(request[, options]) → Stream
Equivalent to listDataSources, but returns a NodeJS Stream object.
This fetches the paged responses for listDataSources continuously and invokes the callback registered for 'data' event for each element in the responses.
The returned object has 'end' method when no more elements are required.
autoPaginate option will be ignored.
Example
const bigqueryDataTransfer = require('@google-cloud/bigquery-data-transfer');
const client = new bigqueryDataTransfer.v1.DataTransferServiceClient({
// optional auth parameters.
});
const formattedParent = client.projectPath('[PROJECT]');
client.listDataSourcesStream({parent: formattedParent})
.on('data', element => {
// doThingsWith(element)
}).on('error', err => {
console.log(err);
});
Parameters
| Name | Type | Optional | Description | ||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
request |
Object |
|
The request object that will be sent. Values in
|
||||||||||||
|
options |
Object |
Yes |
Optional parameters. You can override the default settings for this call, e.g, timeout, retries, paginations, etc. See gax.CallOptions for the details. |
- See also
- https://nodejs.org/api/stream.html
- Returns
StreamAn object stream which emits an object representing DataSource on 'data' event.
listTransferConfigs(request[, options][, callback]) → Promise
Returns information about all data transfers in the project.
Example
const bigqueryDataTransfer = require('@google-cloud/bigquery-data-transfer');
const client = new bigqueryDataTransfer.v1.DataTransferServiceClient({
// optional auth parameters.
});
// Iterate over all elements.
const formattedParent = client.projectPath('[PROJECT]');
client.listTransferConfigs({parent: formattedParent})
.then(responses => {
const resources = responses[0];
for (const resource of resources) {
// doThingsWith(resource)
}
})
.catch(err => {
console.error(err);
});
// Or obtain the paged response.
const formattedParent = client.projectPath('[PROJECT]');
const options = {autoPaginate: false};
const callback = responses => {
// The actual resources in a response.
const resources = responses[0];
// The next request if the response shows that there are more responses.
const nextRequest = responses[1];
// The actual response object, if necessary.
// const rawResponse = responses[2];
for (const resource of resources) {
// doThingsWith(resource);
}
if (nextRequest) {
// Fetch the next page.
return client.listTransferConfigs(nextRequest, options).then(callback);
}
}
client.listTransferConfigs({parent: formattedParent}, options)
.then(callback)
.catch(err => {
console.error(err);
});
Parameters
| Name | Type | Optional | Description | ||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
request |
Object |
|
The request object that will be sent. Values in
|
||||||||||||||||
|
options |
Object |
Yes |
Optional parameters. You can override the default settings for this call, e.g, timeout, retries, paginations, etc. See gax.CallOptions for the details. |
||||||||||||||||
|
callback |
function(nullable Error, nullable Array, nullable Object, nullable Object) |
Yes |
The function which will be called with the result of the API call. The second parameter to the callback is Array of TransferConfig. When autoPaginate: false is specified through options, it contains the result in a single response. If the response indicates the next page exists, the third parameter is set to be used for the next request object. The fourth parameter keeps the raw response object of an object representing ListTransferConfigsResponse. |
- Returns
Promise-
The promise which resolves to an array. The first element of the array is Array of TransferConfig.
When autoPaginate: false is specified through options, the array has three elements. The first element is Array of TransferConfig in a single response. The second element is the next request object if the response indicates the next page exists, or null. The third element is an object representing ListTransferConfigsResponse.
The promise has a method named "cancel" which cancels the ongoing API call.
-
listTransferConfigsStream(request[, options]) → Stream
Equivalent to listTransferConfigs, but returns a NodeJS Stream object.
This fetches the paged responses for listTransferConfigs continuously and invokes the callback registered for 'data' event for each element in the responses.
The returned object has 'end' method when no more elements are required.
autoPaginate option will be ignored.
Example
const bigqueryDataTransfer = require('@google-cloud/bigquery-data-transfer');
const client = new bigqueryDataTransfer.v1.DataTransferServiceClient({
// optional auth parameters.
});
const formattedParent = client.projectPath('[PROJECT]');
client.listTransferConfigsStream({parent: formattedParent})
.on('data', element => {
// doThingsWith(element)
}).on('error', err => {
console.log(err);
});
Parameters
| Name | Type | Optional | Description | ||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
request |
Object |
|
The request object that will be sent. Values in
|
||||||||||||||||
|
options |
Object |
Yes |
Optional parameters. You can override the default settings for this call, e.g, timeout, retries, paginations, etc. See gax.CallOptions for the details. |
- See also
- https://nodejs.org/api/stream.html
- Returns
StreamAn object stream which emits an object representing TransferConfig on 'data' event.
listTransferLogs(request[, options][, callback]) → Promise
Returns user facing log messages for the data transfer run.
Example
const bigqueryDataTransfer = require('@google-cloud/bigquery-data-transfer');
const client = new bigqueryDataTransfer.v1.DataTransferServiceClient({
// optional auth parameters.
});
// Iterate over all elements.
const formattedParent = client.projectRunPath('[PROJECT]', '[TRANSFER_CONFIG]', '[RUN]');
client.listTransferLogs({parent: formattedParent})
.then(responses => {
const resources = responses[0];
for (const resource of resources) {
// doThingsWith(resource)
}
})
.catch(err => {
console.error(err);
});
// Or obtain the paged response.
const formattedParent = client.projectRunPath('[PROJECT]', '[TRANSFER_CONFIG]', '[RUN]');
const options = {autoPaginate: false};
const callback = responses => {
// The actual resources in a response.
const resources = responses[0];
// The next request if the response shows that there are more responses.
const nextRequest = responses[1];
// The actual response object, if necessary.
// const rawResponse = responses[2];
for (const resource of resources) {
// doThingsWith(resource);
}
if (nextRequest) {
// Fetch the next page.
return client.listTransferLogs(nextRequest, options).then(callback);
}
}
client.listTransferLogs({parent: formattedParent}, options)
.then(callback)
.catch(err => {
console.error(err);
});
Parameters
| Name | Type | Optional | Description | ||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
request |
Object |
|
The request object that will be sent. Values in
|
||||||||||||||||
|
options |
Object |
Yes |
Optional parameters. You can override the default settings for this call, e.g, timeout, retries, paginations, etc. See gax.CallOptions for the details. |
||||||||||||||||
|
callback |
function(nullable Error, nullable Array, nullable Object, nullable Object) |
Yes |
The function which will be called with the result of the API call. The second parameter to the callback is Array of TransferMessage. When autoPaginate: false is specified through options, it contains the result in a single response. If the response indicates the next page exists, the third parameter is set to be used for the next request object. The fourth parameter keeps the raw response object of an object representing ListTransferLogsResponse. |
- Returns
Promise-
The promise which resolves to an array. The first element of the array is Array of TransferMessage.
When autoPaginate: false is specified through options, the array has three elements. The first element is Array of TransferMessage in a single response. The second element is the next request object if the response indicates the next page exists, or null. The third element is an object representing ListTransferLogsResponse.
The promise has a method named "cancel" which cancels the ongoing API call.
-
listTransferLogsStream(request[, options]) → Stream
Equivalent to listTransferLogs, but returns a NodeJS Stream object.
This fetches the paged responses for listTransferLogs continuously and invokes the callback registered for 'data' event for each element in the responses.
The returned object has 'end' method when no more elements are required.
autoPaginate option will be ignored.
Example
const bigqueryDataTransfer = require('@google-cloud/bigquery-data-transfer');
const client = new bigqueryDataTransfer.v1.DataTransferServiceClient({
// optional auth parameters.
});
const formattedParent = client.projectRunPath('[PROJECT]', '[TRANSFER_CONFIG]', '[RUN]');
client.listTransferLogsStream({parent: formattedParent})
.on('data', element => {
// doThingsWith(element)
}).on('error', err => {
console.log(err);
});
Parameters
| Name | Type | Optional | Description | ||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
request |
Object |
|
The request object that will be sent. Values in
|
||||||||||||||||
|
options |
Object |
Yes |
Optional parameters. You can override the default settings for this call, e.g, timeout, retries, paginations, etc. See gax.CallOptions for the details. |
- See also
- https://nodejs.org/api/stream.html
- Returns
StreamAn object stream which emits an object representing TransferMessage on 'data' event.
listTransferRuns(request[, options][, callback]) → Promise
Returns information about running and completed jobs.
Example
const bigqueryDataTransfer = require('@google-cloud/bigquery-data-transfer');
const client = new bigqueryDataTransfer.v1.DataTransferServiceClient({
// optional auth parameters.
});
// Iterate over all elements.
const formattedParent = client.projectTransferConfigPath('[PROJECT]', '[TRANSFER_CONFIG]');
client.listTransferRuns({parent: formattedParent})
.then(responses => {
const resources = responses[0];
for (const resource of resources) {
// doThingsWith(resource)
}
})
.catch(err => {
console.error(err);
});
// Or obtain the paged response.
const formattedParent = client.projectTransferConfigPath('[PROJECT]', '[TRANSFER_CONFIG]');
const options = {autoPaginate: false};
const callback = responses => {
// The actual resources in a response.
const resources = responses[0];
// The next request if the response shows that there are more responses.
const nextRequest = responses[1];
// The actual response object, if necessary.
// const rawResponse = responses[2];
for (const resource of resources) {
// doThingsWith(resource);
}
if (nextRequest) {
// Fetch the next page.
return client.listTransferRuns(nextRequest, options).then(callback);
}
}
client.listTransferRuns({parent: formattedParent}, options)
.then(callback)
.catch(err => {
console.error(err);
});
Parameters
| Name | Type | Optional | Description | ||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
request |
Object |
|
The request object that will be sent. Values in
|
||||||||||||||||||||
|
options |
Object |
Yes |
Optional parameters. You can override the default settings for this call, e.g, timeout, retries, paginations, etc. See gax.CallOptions for the details. |
||||||||||||||||||||
|
callback |
function(nullable Error, nullable Array, nullable Object, nullable Object) |
Yes |
The function which will be called with the result of the API call. The second parameter to the callback is Array of TransferRun. When autoPaginate: false is specified through options, it contains the result in a single response. If the response indicates the next page exists, the third parameter is set to be used for the next request object. The fourth parameter keeps the raw response object of an object representing ListTransferRunsResponse. |
- Returns
Promise-
The promise which resolves to an array. The first element of the array is Array of TransferRun.
When autoPaginate: false is specified through options, the array has three elements. The first element is Array of TransferRun in a single response. The second element is the next request object if the response indicates the next page exists, or null. The third element is an object representing ListTransferRunsResponse.
The promise has a method named "cancel" which cancels the ongoing API call.
-
listTransferRunsStream(request[, options]) → Stream
Equivalent to listTransferRuns, but returns a NodeJS Stream object.
This fetches the paged responses for listTransferRuns continuously and invokes the callback registered for 'data' event for each element in the responses.
The returned object has 'end' method when no more elements are required.
autoPaginate option will be ignored.
Example
const bigqueryDataTransfer = require('@google-cloud/bigquery-data-transfer');
const client = new bigqueryDataTransfer.v1.DataTransferServiceClient({
// optional auth parameters.
});
const formattedParent = client.projectTransferConfigPath('[PROJECT]', '[TRANSFER_CONFIG]');
client.listTransferRunsStream({parent: formattedParent})
.on('data', element => {
// doThingsWith(element)
}).on('error', err => {
console.log(err);
});
Parameters
| Name | Type | Optional | Description | ||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
request |
Object |
|
The request object that will be sent. Values in
|
||||||||||||||||||||
|
options |
Object |
Yes |
Optional parameters. You can override the default settings for this call, e.g, timeout, retries, paginations, etc. See gax.CallOptions for the details. |
- See also
- https://nodejs.org/api/stream.html
- Returns
StreamAn object stream which emits an object representing TransferRun on 'data' event.
matchDataSourceFromProjectDataSourceName(projectDataSourceName) → String
Parse the projectDataSourceName from a project_data_source resource.
Parameter
| Name | Type | Optional | Description |
|---|---|---|---|
|
projectDataSourceName |
String |
|
A fully-qualified path representing a project_data_source resources. |
- Returns
String- A string representing the data_source.
matchProjectFromProjectDataSourceName(projectDataSourceName) → String
Parse the projectDataSourceName from a project_data_source resource.
Parameter
| Name | Type | Optional | Description |
|---|---|---|---|
|
projectDataSourceName |
String |
|
A fully-qualified path representing a project_data_source resources. |
- Returns
String- A string representing the project.
matchProjectFromProjectName(projectName) → String
Parse the projectName from a project resource.
Parameter
| Name | Type | Optional | Description |
|---|---|---|---|
|
projectName |
String |
|
A fully-qualified path representing a project resources. |
- Returns
String- A string representing the project.
matchProjectFromProjectRunName(projectRunName) → String
Parse the projectRunName from a project_run resource.
Parameter
| Name | Type | Optional | Description |
|---|---|---|---|
|
projectRunName |
String |
|
A fully-qualified path representing a project_run resources. |
- Returns
String- A string representing the project.
matchProjectFromProjectTransferConfigName(projectTransferConfigName) → String
Parse the projectTransferConfigName from a project_transfer_config resource.
Parameter
| Name | Type | Optional | Description |
|---|---|---|---|
|
projectTransferConfigName |
String |
|
A fully-qualified path representing a project_transfer_config resources. |
- Returns
String- A string representing the project.
matchRunFromProjectRunName(projectRunName) → String
Parse the projectRunName from a project_run resource.
Parameter
| Name | Type | Optional | Description |
|---|---|---|---|
|
projectRunName |
String |
|
A fully-qualified path representing a project_run resources. |
- Returns
String- A string representing the run.
matchTransferConfigFromProjectRunName(projectRunName) → String
Parse the projectRunName from a project_run resource.
Parameter
| Name | Type | Optional | Description |
|---|---|---|---|
|
projectRunName |
String |
|
A fully-qualified path representing a project_run resources. |
- Returns
String- A string representing the transfer_config.
matchTransferConfigFromProjectTransferConfigName(projectTransferConfigName) → String
Parse the projectTransferConfigName from a project_transfer_config resource.
Parameter
| Name | Type | Optional | Description |
|---|---|---|---|
|
projectTransferConfigName |
String |
|
A fully-qualified path representing a project_transfer_config resources. |
- Returns
String- A string representing the transfer_config.
projectDataSourcePath(project, dataSource) → String
Return a fully-qualified project_data_source resource name string.
Parameters
| Name | Type | Optional | Description |
|---|---|---|---|
|
project |
String |
|
|
|
dataSource |
String |
|
- Returns
String
projectPath(project) → String
Return a fully-qualified project resource name string.
Parameter
| Name | Type | Optional | Description |
|---|---|---|---|
|
project |
String |
|
- Returns
String
projectRunPath(project, transferConfig, run) → String
Return a fully-qualified project_run resource name string.
Parameters
| Name | Type | Optional | Description |
|---|---|---|---|
|
project |
String |
|
|
|
transferConfig |
String |
|
|
|
run |
String |
|
- Returns
String
projectTransferConfigPath(project, transferConfig) → String
Return a fully-qualified project_transfer_config resource name string.
Parameters
| Name | Type | Optional | Description |
|---|---|---|---|
|
project |
String |
|
|
|
transferConfig |
String |
|
- Returns
String
scheduleTransferRuns(request[, options][, callback]) → Promise
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.
Example
const bigqueryDataTransfer = require('@google-cloud/bigquery-data-transfer');
const client = new bigqueryDataTransfer.v1.DataTransferServiceClient({
// optional auth parameters.
});
const formattedParent = client.projectTransferConfigPath('[PROJECT]', '[TRANSFER_CONFIG]');
const startTime = {};
const endTime = {};
const request = {
parent: formattedParent,
startTime: startTime,
endTime: endTime,
};
client.scheduleTransferRuns(request)
.then(responses => {
const response = responses[0];
// doThingsWith(response)
})
.catch(err => {
console.error(err);
});
Parameters
| Name | Type | Optional | Description | ||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
request |
Object |
|
The request object that will be sent. Values in
|
||||||||||||||||||||
|
options |
Object |
Yes |
Optional parameters. You can override the default settings for this call, e.g, timeout, retries, paginations, etc. See gax.CallOptions for the details. |
||||||||||||||||||||
|
callback |
function(nullable Error, nullable Object) |
Yes |
The function which will be called with the result of the API call. The second parameter to the callback is an object representing ScheduleTransferRunsResponse. |
- Returns
Promise- The promise which resolves to an array. The first element of the array is an object representing ScheduleTransferRunsResponse. The promise has a method named "cancel" which cancels the ongoing API call.
startManualTransferRuns(request[, options][, callback]) → Promise
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.
Example
const bigqueryDataTransfer = require('@google-cloud/bigquery-data-transfer');
const client = new bigqueryDataTransfer.v1.DataTransferServiceClient({
// optional auth parameters.
});
client.startManualTransferRuns({})
.then(responses => {
const response = responses[0];
// doThingsWith(response)
})
.catch(err => {
console.error(err);
});
Parameters
| Name | Type | Optional | Description | ||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
request |
Object |
|
The request object that will be sent. Values in
|
||||||||||||||||||||
|
options |
Object |
Yes |
Optional parameters. You can override the default settings for this call, e.g, timeout, retries, paginations, etc. See gax.CallOptions for the details. |
||||||||||||||||||||
|
callback |
function(nullable Error, nullable Object) |
Yes |
The function which will be called with the result of the API call. The second parameter to the callback is an object representing StartManualTransferRunsResponse. |
- Returns
Promise- The promise which resolves to an array. The first element of the array is an object representing StartManualTransferRunsResponse. The promise has a method named "cancel" which cancels the ongoing API call.
updateTransferConfig(request[, options][, callback]) → Promise
Updates a data transfer configuration. All fields must be set, even if they are not updated.
Example
const bigqueryDataTransfer = require('@google-cloud/bigquery-data-transfer');
const client = new bigqueryDataTransfer.v1.DataTransferServiceClient({
// optional auth parameters.
});
const transferConfig = {};
const updateMask = {};
const request = {
transferConfig: transferConfig,
updateMask: updateMask,
};
client.updateTransferConfig(request)
.then(responses => {
const response = responses[0];
// doThingsWith(response)
})
.catch(err => {
console.error(err);
});
Parameters
| Name | Type | Optional | Description | ||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
request |
Object |
|
The request object that will be sent. Values in
|
||||||||||||||||||||
|
options |
Object |
Yes |
Optional parameters. You can override the default settings for this call, e.g, timeout, retries, paginations, etc. See gax.CallOptions for the details. |
||||||||||||||||||||
|
callback |
function(nullable Error, nullable Object) |
Yes |
The function which will be called with the result of the API call. The second parameter to the callback is an object representing TransferConfig. |
- Returns
Promise- The promise which resolves to an array. The first element of the array is an object representing TransferConfig. The promise has a method named "cancel" which cancels the ongoing API call.