Constructor

DataTransferServiceClient

new DataTransferServiceClient(options)

Construct an instance of DataTransferServiceClient.

Parameter

options

Optional

object

The configuration object. See the subsequent parameters for more details.

Values in options have the following properties:

Parameter

credentials

Optional

object

Credentials object.

credentials.client_email

Optional

string

credentials.private_key

Optional

string

email

Optional

string

Account email address. Required when usaing a .pem or .p12 keyFilename.

keyFilename

Optional

string

Full path to the a .json, .pem, or .p12 key downloaded from the Google Developers Console. If you provide a path to a JSON file, the projectId option above is not necessary. NOTE: .pem and .p12 require you to specify options.email as well.

port

Optional

number

The port on which to connect to the remote host.

projectId

Optional

string

The project ID from the Google Developer's Console, e.g. 'grape-spaceship-123'. We will also check the environment variable GCLOUD_PROJECT for your project ID. If your app is running in an environment which supports Application Default Credentials, your project ID will be detected automatically.

promise

Optional

function()

Custom promise module to use instead of native Promises.

servicePath

Optional

string

The domain name of the API remote host.

Properties

port

static

The port for this API service.

scopes

static

The scopes needed to make gRPC calls for every method defined in this service.

servicePath

static

The DNS address for this API service.

Methods

checkValidCreds

checkValidCreds(request, options, callback) returns 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.

Parameter

request

Object

The request object that will be sent.

Values in request have the following properties:

Parameter

name

string

The data source in the form: projects/{project_id}/dataSources/{data_source_id}

options

Optional

Object

Optional parameters. You can override the default settings for this call, e.g, timeout, retries, paginations, etc. See gax.CallOptions for the details.

callback

Optional

function(nullable Error, nullable Object)

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.

Example

const bigqueryDataTransfer = require('@google-cloud/bigquery-data-transfer');

var client = new bigqueryDataTransfer.v1.DataTransferServiceClient({
  // optional auth parameters.
});

var formattedName = client.locationDataSourcePath('[PROJECT]', '[LOCATION]', '[DATA_SOURCE]');
client.checkValidCreds({name: formattedName})
  .then(responses => {
    var response = responses[0];
    // doThingsWith(response)
  })
  .catch(err => {
    console.error(err);
  });

createTransferConfig

createTransferConfig(request, options, callback) returns Promise

Creates a new data transfer configuration.

Parameter

request

Object

The request object that will be sent.

Values in request have the following properties:

Parameter

parent

string

The BigQuery project id where the transfer configuration should be created. Must be in the format /projects/{project_id}/locations/{location_id} If specified location and location of the destination bigquery dataset do not match - the request will fail.

transferConfig

Object

Data transfer configuration to create.

This object should have the same structure as TransferConfig

authorizationCode

Optional

string

Optional OAuth2 authorization code to use with this transfer configuration. This is required if new credentials are needed, as indicated by CheckValidCreds. In order to obtain authorization_code, please make a request to https:// www.gstatic.com/bigquerydatatransfer/oauthz/auth?client_id= &scope=<data_source_scopes>&redirect_uri=<redirect_uri>

  • client_id should be OAuth client_id of BigQuery DTS API for the given data source returned by ListDataSources method.
  • data_source_scopes are the scopes returned by ListDataSources method.
  • redirect_uri is an optional parameter. If not specified, then authorization code is posted to the opener of authorization flow window. Otherwise it will be sent to the redirect uri. A special value of urn:ietf:wg:oauth:2.0:oob means that authorization code should be returned in the title bar of the browser, with the page text prompting the user to copy the code and paste it in the application.

options

Optional

Object

Optional parameters. You can override the default settings for this call, e.g, timeout, retries, paginations, etc. See gax.CallOptions for the details.

callback

Optional

function(nullable Error, nullable Object)

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.

Example

const bigqueryDataTransfer = require('@google-cloud/bigquery-data-transfer');

var client = new bigqueryDataTransfer.v1.DataTransferServiceClient({
  // optional auth parameters.
});

var formattedParent = client.locationPath('[PROJECT]', '[LOCATION]');
var transferConfig = {};
var request = {
  parent: formattedParent,
  transferConfig: transferConfig,
};
client.createTransferConfig(request)
  .then(responses => {
    var response = responses[0];
    // doThingsWith(response)
  })
  .catch(err => {
    console.error(err);
  });

dataSourcePath

dataSourcePath(project, dataSource) returns String

Return a fully-qualified data_source resource name string.

Parameter

project

String

dataSource

String

Returns

String 

deleteTransferConfig

deleteTransferConfig(request, options, callback) returns Promise

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

Parameter

request

Object

The request object that will be sent.

Values in request have the following properties:

Parameter

name

string

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

options

Optional

Object

Optional parameters. You can override the default settings for this call, e.g, timeout, retries, paginations, etc. See gax.CallOptions for the details.

callback

Optional

function(nullable Error)

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.

Example

const bigqueryDataTransfer = require('@google-cloud/bigquery-data-transfer');

var client = new bigqueryDataTransfer.v1.DataTransferServiceClient({
  // optional auth parameters.
});

var formattedName = client.locationTransferConfigPath('[PROJECT]', '[LOCATION]', '[TRANSFER_CONFIG]');
client.deleteTransferConfig({name: formattedName}).catch(err => {
  console.error(err);
});

deleteTransferRun

deleteTransferRun(request, options, callback) returns Promise

Deletes the specified transfer run.

Parameter

request

Object

The request object that will be sent.

Values in request have the following properties:

Parameter

name

string

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

options

Optional

Object

Optional parameters. You can override the default settings for this call, e.g, timeout, retries, paginations, etc. See gax.CallOptions for the details.

callback

Optional

function(nullable Error)

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.

Example

const bigqueryDataTransfer = require('@google-cloud/bigquery-data-transfer');

var client = new bigqueryDataTransfer.v1.DataTransferServiceClient({
  // optional auth parameters.
});

var formattedName = client.locationRunPath('[PROJECT]', '[LOCATION]', '[TRANSFER_CONFIG]', '[RUN]');
client.deleteTransferRun({name: formattedName}).catch(err => {
  console.error(err);
});

getDataSource

getDataSource(request, options, callback) returns Promise

Retrieves a supported data source and returns its settings, which can be used for UI rendering.

Parameter

request

Object

The request object that will be sent.

Values in request have the following properties:

Parameter

name

string

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

options

Optional

Object

Optional parameters. You can override the default settings for this call, e.g, timeout, retries, paginations, etc. See gax.CallOptions for the details.

callback

Optional

function(nullable Error, nullable Object)

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.

Example

const bigqueryDataTransfer = require('@google-cloud/bigquery-data-transfer');

var client = new bigqueryDataTransfer.v1.DataTransferServiceClient({
  // optional auth parameters.
});

var formattedName = client.locationDataSourcePath('[PROJECT]', '[LOCATION]', '[DATA_SOURCE]');
client.getDataSource({name: formattedName})
  .then(responses => {
    var response = responses[0];
    // doThingsWith(response)
  })
  .catch(err => {
    console.error(err);
  });

getProjectId

getProjectId(callback)

Return the project ID used by this class.

Parameter

callback

function(Error, string)

the callback to be called with the current project Id.

getTransferConfig

getTransferConfig(request, options, callback) returns Promise

Returns information about a data transfer config.

Parameter

request

Object

The request object that will be sent.

Values in request have the following properties:

Parameter

name

string

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

options

Optional

Object

Optional parameters. You can override the default settings for this call, e.g, timeout, retries, paginations, etc. See gax.CallOptions for the details.

callback

Optional

function(nullable Error, nullable Object)

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.

Example

const bigqueryDataTransfer = require('@google-cloud/bigquery-data-transfer');

var client = new bigqueryDataTransfer.v1.DataTransferServiceClient({
  // optional auth parameters.
});

var formattedName = client.locationTransferConfigPath('[PROJECT]', '[LOCATION]', '[TRANSFER_CONFIG]');
client.getTransferConfig({name: formattedName})
  .then(responses => {
    var response = responses[0];
    // doThingsWith(response)
  })
  .catch(err => {
    console.error(err);
  });

getTransferRun

getTransferRun(request, options, callback) returns Promise

Returns information about the particular transfer run.

Parameter

request

Object

The request object that will be sent.

Values in request have the following properties:

Parameter

name

string

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

options

Optional

Object

Optional parameters. You can override the default settings for this call, e.g, timeout, retries, paginations, etc. See gax.CallOptions for the details.

callback

Optional

function(nullable Error, nullable Object)

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.

Example

const bigqueryDataTransfer = require('@google-cloud/bigquery-data-transfer');

var client = new bigqueryDataTransfer.v1.DataTransferServiceClient({
  // optional auth parameters.
});

var formattedName = client.locationRunPath('[PROJECT]', '[LOCATION]', '[TRANSFER_CONFIG]', '[RUN]');
client.getTransferRun({name: formattedName})
  .then(responses => {
    var response = responses[0];
    // doThingsWith(response)
  })
  .catch(err => {
    console.error(err);
  });

listDataSources

listDataSources(request, options, callback) returns Promise

Lists supported data sources and returns their settings, which can be used for UI rendering.

Parameter

request

Object

The request object that will be sent.

Values in request have the following properties:

Parameter

parent

string

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

pageSize

Optional

number

The maximum number of resources contained in the underlying API response. If page streaming is performed per-resource, this parameter does not affect the return value. If page streaming is performed per-page, this determines the maximum number of resources in a page.

options

Optional

Object

Optional parameters. You can override the default settings for this call, e.g, timeout, retries, paginations, etc. See gax.CallOptions for the details.

callback

Optional

function(nullable Error, nullable Array, nullable Object, nullable Object)

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.

Example

const bigqueryDataTransfer = require('@google-cloud/bigquery-data-transfer');

var client = new bigqueryDataTransfer.v1.DataTransferServiceClient({
  // optional auth parameters.
});

// Iterate over all elements.
var formattedParent = client.locationPath('[PROJECT]', '[LOCATION]');

client.listDataSources({parent: formattedParent})
  .then(responses => {
    var resources = responses[0];
    for (let i = 0; i < resources.length; i += 1) {
      // doThingsWith(resources[i])
    }
  })
  .catch(err => {
    console.error(err);
  });

// Or obtain the paged response.
var formattedParent = client.locationPath('[PROJECT]', '[LOCATION]');


var options = {autoPaginate: false};
var callback = responses => {
  // The actual resources in a response.
  var resources = responses[0];
  // The next request if the response shows that there are more responses.
  var nextRequest = responses[1];
  // The actual response object, if necessary.
  // var rawResponse = responses[2];
  for (let i = 0; i < resources.length; i += 1) {
    // doThingsWith(resources[i]);
  }
  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);
  });

listDataSourcesStream

listDataSourcesStream(request, options) returns 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.

Parameter

request

Object

The request object that will be sent.

Values in request have the following properties:

Parameter

parent

string

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

pageSize

Optional

number

The maximum number of resources contained in the underlying API response. If page streaming is performed per-resource, this parameter does not affect the return value. If page streaming is performed per-page, this determines the maximum number of resources in a page.

options

Optional

Object

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

Stream 

An object stream which emits an object representing DataSource on 'data' event.

Example

const bigqueryDataTransfer = require('@google-cloud/bigquery-data-transfer');

var client = new bigqueryDataTransfer.v1.DataTransferServiceClient({
  // optional auth parameters.
});

var formattedParent = client.locationPath('[PROJECT]', '[LOCATION]');
client.listDataSourcesStream({parent: formattedParent})
  .on('data', element => {
    // doThingsWith(element)
  }).on('error', err => {
    console.log(err);
  });

listTransferConfigs

listTransferConfigs(request, options, callback) returns Promise

Returns information about all data transfers in the project.

Parameter

request

Object

The request object that will be sent.

Values in request have the following properties:

Parameter

parent

string

The BigQuery project id for which data sources should be returned: projects/{project_id}.

dataSourceIds

Optional

Array of string

When specified, only configurations of requested data sources are returned.

pageSize

Optional

number

The maximum number of resources contained in the underlying API response. If page streaming is performed per-resource, this parameter does not affect the return value. If page streaming is performed per-page, this determines the maximum number of resources in a page.

options

Optional

Object

Optional parameters. You can override the default settings for this call, e.g, timeout, retries, paginations, etc. See gax.CallOptions for the details.

callback

Optional

function(nullable Error, nullable Array, nullable Object, nullable Object)

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.

Example

const bigqueryDataTransfer = require('@google-cloud/bigquery-data-transfer');

var client = new bigqueryDataTransfer.v1.DataTransferServiceClient({
  // optional auth parameters.
});

// Iterate over all elements.
var formattedParent = client.locationPath('[PROJECT]', '[LOCATION]');

client.listTransferConfigs({parent: formattedParent})
  .then(responses => {
    var resources = responses[0];
    for (let i = 0; i < resources.length; i += 1) {
      // doThingsWith(resources[i])
    }
  })
  .catch(err => {
    console.error(err);
  });

// Or obtain the paged response.
var formattedParent = client.locationPath('[PROJECT]', '[LOCATION]');


var options = {autoPaginate: false};
var callback = responses => {
  // The actual resources in a response.
  var resources = responses[0];
  // The next request if the response shows that there are more responses.
  var nextRequest = responses[1];
  // The actual response object, if necessary.
  // var rawResponse = responses[2];
  for (let i = 0; i < resources.length; i += 1) {
    // doThingsWith(resources[i]);
  }
  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);
  });

listTransferConfigsStream

listTransferConfigsStream(request, options) returns 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.

Parameter

request

Object

The request object that will be sent.

Values in request have the following properties:

Parameter

parent

string

The BigQuery project id for which data sources should be returned: projects/{project_id}.

dataSourceIds

Optional

Array of string

When specified, only configurations of requested data sources are returned.

pageSize

Optional

number

The maximum number of resources contained in the underlying API response. If page streaming is performed per-resource, this parameter does not affect the return value. If page streaming is performed per-page, this determines the maximum number of resources in a page.

options

Optional

Object

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

Stream 

An object stream which emits an object representing TransferConfig on 'data' event.

Example

const bigqueryDataTransfer = require('@google-cloud/bigquery-data-transfer');

var client = new bigqueryDataTransfer.v1.DataTransferServiceClient({
  // optional auth parameters.
});

var formattedParent = client.locationPath('[PROJECT]', '[LOCATION]');
client.listTransferConfigsStream({parent: formattedParent})
  .on('data', element => {
    // doThingsWith(element)
  }).on('error', err => {
    console.log(err);
  });

listTransferLogs

listTransferLogs(request, options, callback) returns Promise

Returns user facing log messages for the data transfer run.

Parameter

request

Object

The request object that will be sent.

Values in request have the following properties:

Parameter

parent

string

Transfer run name in the form: projects/{project_id}/transferConfigs/{config_Id}/runs/{run_id}.

pageSize

Optional

number

The maximum number of resources contained in the underlying API response. If page streaming is performed per-resource, this parameter does not affect the return value. If page streaming is performed per-page, this determines the maximum number of resources in a page.

messageTypes

Optional

Array of number

Message types to return. If not populated - INFO, WARNING and ERROR messages are returned.

The number should be among the values of MessageSeverity

options

Optional

Object

Optional parameters. You can override the default settings for this call, e.g, timeout, retries, paginations, etc. See gax.CallOptions for the details.

callback

Optional

function(nullable Error, nullable Array, nullable Object, nullable Object)

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.

Example

const bigqueryDataTransfer = require('@google-cloud/bigquery-data-transfer');

var client = new bigqueryDataTransfer.v1.DataTransferServiceClient({
  // optional auth parameters.
});

// Iterate over all elements.
var formattedParent = client.locationRunPath('[PROJECT]', '[LOCATION]', '[TRANSFER_CONFIG]', '[RUN]');

client.listTransferLogs({parent: formattedParent})
  .then(responses => {
    var resources = responses[0];
    for (let i = 0; i < resources.length; i += 1) {
      // doThingsWith(resources[i])
    }
  })
  .catch(err => {
    console.error(err);
  });

// Or obtain the paged response.
var formattedParent = client.locationRunPath('[PROJECT]', '[LOCATION]', '[TRANSFER_CONFIG]', '[RUN]');


var options = {autoPaginate: false};
var callback = responses => {
  // The actual resources in a response.
  var resources = responses[0];
  // The next request if the response shows that there are more responses.
  var nextRequest = responses[1];
  // The actual response object, if necessary.
  // var rawResponse = responses[2];
  for (let i = 0; i < resources.length; i += 1) {
    // doThingsWith(resources[i]);
  }
  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);
  });

listTransferLogsStream

listTransferLogsStream(request, options) returns 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.

Parameter

request

Object

The request object that will be sent.

Values in request have the following properties:

Parameter

parent

string

Transfer run name in the form: projects/{project_id}/transferConfigs/{config_Id}/runs/{run_id}.

pageSize

Optional

number

The maximum number of resources contained in the underlying API response. If page streaming is performed per-resource, this parameter does not affect the return value. If page streaming is performed per-page, this determines the maximum number of resources in a page.

messageTypes

Optional

Array of number

Message types to return. If not populated - INFO, WARNING and ERROR messages are returned.

The number should be among the values of MessageSeverity

options

Optional

Object

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

Stream 

An object stream which emits an object representing TransferMessage on 'data' event.

Example

const bigqueryDataTransfer = require('@google-cloud/bigquery-data-transfer');

var client = new bigqueryDataTransfer.v1.DataTransferServiceClient({
  // optional auth parameters.
});

var formattedParent = client.locationRunPath('[PROJECT]', '[LOCATION]', '[TRANSFER_CONFIG]', '[RUN]');
client.listTransferLogsStream({parent: formattedParent})
  .on('data', element => {
    // doThingsWith(element)
  }).on('error', err => {
    console.log(err);
  });

listTransferRuns

listTransferRuns(request, options, callback) returns Promise

Returns information about running and completed jobs.

Parameter

request

Object

The request object that will be sent.

Values in request have the following properties:

Parameter

parent

string

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

states

Optional

Array of number

When specified, only transfer runs with requested states are returned.

The number should be among the values of TransferState

pageSize

Optional

number

The maximum number of resources contained in the underlying API response. If page streaming is performed per-resource, this parameter does not affect the return value. If page streaming is performed per-page, this determines the maximum number of resources in a page.

runAttempt

Optional

number

Indicates how run attempts are to be pulled.

The number should be among the values of RunAttempt

options

Optional

Object

Optional parameters. You can override the default settings for this call, e.g, timeout, retries, paginations, etc. See gax.CallOptions for the details.

callback

Optional

function(nullable Error, nullable Array, nullable Object, nullable Object)

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.

Example

const bigqueryDataTransfer = require('@google-cloud/bigquery-data-transfer');

var client = new bigqueryDataTransfer.v1.DataTransferServiceClient({
  // optional auth parameters.
});

// Iterate over all elements.
var formattedParent = client.locationTransferConfigPath('[PROJECT]', '[LOCATION]', '[TRANSFER_CONFIG]');

client.listTransferRuns({parent: formattedParent})
  .then(responses => {
    var resources = responses[0];
    for (let i = 0; i < resources.length; i += 1) {
      // doThingsWith(resources[i])
    }
  })
  .catch(err => {
    console.error(err);
  });

// Or obtain the paged response.
var formattedParent = client.locationTransferConfigPath('[PROJECT]', '[LOCATION]', '[TRANSFER_CONFIG]');


var options = {autoPaginate: false};
var callback = responses => {
  // The actual resources in a response.
  var resources = responses[0];
  // The next request if the response shows that there are more responses.
  var nextRequest = responses[1];
  // The actual response object, if necessary.
  // var rawResponse = responses[2];
  for (let i = 0; i < resources.length; i += 1) {
    // doThingsWith(resources[i]);
  }
  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);
  });

listTransferRunsStream

listTransferRunsStream(request, options) returns 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.

Parameter

request

Object

The request object that will be sent.

Values in request have the following properties:

Parameter

parent

string

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

states

Optional

Array of number

When specified, only transfer runs with requested states are returned.

The number should be among the values of TransferState

pageSize

Optional

number

The maximum number of resources contained in the underlying API response. If page streaming is performed per-resource, this parameter does not affect the return value. If page streaming is performed per-page, this determines the maximum number of resources in a page.

runAttempt

Optional

number

Indicates how run attempts are to be pulled.

The number should be among the values of RunAttempt

options

Optional

Object

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

Stream 

An object stream which emits an object representing TransferRun on 'data' event.

Example

const bigqueryDataTransfer = require('@google-cloud/bigquery-data-transfer');

var client = new bigqueryDataTransfer.v1.DataTransferServiceClient({
  // optional auth parameters.
});

var formattedParent = client.locationTransferConfigPath('[PROJECT]', '[LOCATION]', '[TRANSFER_CONFIG]');
client.listTransferRunsStream({parent: formattedParent})
  .on('data', element => {
    // doThingsWith(element)
  }).on('error', err => {
    console.log(err);
  });

locationDataSourcePath

locationDataSourcePath(project, location, dataSource) returns String

Return a fully-qualified location_data_source resource name string.

Parameter

project

String

location

String

dataSource

String

Returns

String 

locationPath

locationPath(project, location) returns String

Return a fully-qualified location resource name string.

Parameter

project

String

location

String

Returns

String 

locationRunPath

locationRunPath(project, location, transferConfig, run) returns String

Return a fully-qualified location_run resource name string.

Parameter

project

String

location

String

transferConfig

String

run

String

Returns

String 

locationTransferConfigPath

locationTransferConfigPath(project, location, transferConfig) returns String

Return a fully-qualified location_transfer_config resource name string.

Parameter

project

String

location

String

transferConfig

String

Returns

String 

matchDataSourceFromDataSourceName

matchDataSourceFromDataSourceName(dataSourceName) returns String

Parse the dataSourceName from a data_source resource.

Parameter

dataSourceName

String

A fully-qualified path representing a data_source resources.

Returns

String 

  • A string representing the data_source.

matchDataSourceFromLocationDataSourceName

matchDataSourceFromLocationDataSourceName(locationDataSourceName) returns String

Parse the locationDataSourceName from a location_data_source resource.

Parameter

locationDataSourceName

String

A fully-qualified path representing a location_data_source resources.

Returns

String 

  • A string representing the data_source.

matchLocationFromLocationDataSourceName

matchLocationFromLocationDataSourceName(locationDataSourceName) returns String

Parse the locationDataSourceName from a location_data_source resource.

Parameter

locationDataSourceName

String

A fully-qualified path representing a location_data_source resources.

Returns

String 

  • A string representing the location.

matchLocationFromLocationName

matchLocationFromLocationName(locationName) returns String

Parse the locationName from a location resource.

Parameter

locationName

String

A fully-qualified path representing a location resources.

Returns

String 

  • A string representing the location.

matchLocationFromLocationRunName

matchLocationFromLocationRunName(locationRunName) returns String

Parse the locationRunName from a location_run resource.

Parameter

locationRunName

String

A fully-qualified path representing a location_run resources.

Returns

String 

  • A string representing the location.

matchLocationFromLocationTransferConfigName

matchLocationFromLocationTransferConfigName(locationTransferConfigName) returns String

Parse the locationTransferConfigName from a location_transfer_config resource.

Parameter

locationTransferConfigName

String

A fully-qualified path representing a location_transfer_config resources.

Returns

String 

  • A string representing the location.

matchProjectFromDataSourceName

matchProjectFromDataSourceName(dataSourceName) returns String

Parse the dataSourceName from a data_source resource.

Parameter

dataSourceName

String

A fully-qualified path representing a data_source resources.

Returns

String 

  • A string representing the project.

matchProjectFromLocationDataSourceName

matchProjectFromLocationDataSourceName(locationDataSourceName) returns String

Parse the locationDataSourceName from a location_data_source resource.

Parameter

locationDataSourceName

String

A fully-qualified path representing a location_data_source resources.

Returns

String 

  • A string representing the project.

matchProjectFromLocationName

matchProjectFromLocationName(locationName) returns String

Parse the locationName from a location resource.

Parameter

locationName

String

A fully-qualified path representing a location resources.

Returns

String 

  • A string representing the project.

matchProjectFromLocationRunName

matchProjectFromLocationRunName(locationRunName) returns String

Parse the locationRunName from a location_run resource.

Parameter

locationRunName

String

A fully-qualified path representing a location_run resources.

Returns

String 

  • A string representing the project.

matchProjectFromLocationTransferConfigName

matchProjectFromLocationTransferConfigName(locationTransferConfigName) returns String

Parse the locationTransferConfigName from a location_transfer_config resource.

Parameter

locationTransferConfigName

String

A fully-qualified path representing a location_transfer_config resources.

Returns

String 

  • A string representing the project.

matchProjectFromProjectName

matchProjectFromProjectName(projectName) returns String

Parse the projectName from a project resource.

Parameter

projectName

String

A fully-qualified path representing a project resources.

Returns

String 

  • A string representing the project.

matchProjectFromRunName

matchProjectFromRunName(runName) returns String

Parse the runName from a run resource.

Parameter

runName

String

A fully-qualified path representing a run resources.

Returns

String 

  • A string representing the project.

matchProjectFromTransferConfigName

matchProjectFromTransferConfigName(transferConfigName) returns String

Parse the transferConfigName from a transfer_config resource.

Parameter

transferConfigName

String

A fully-qualified path representing a transfer_config resources.

Returns

String 

  • A string representing the project.

matchRunFromLocationRunName

matchRunFromLocationRunName(locationRunName) returns String

Parse the locationRunName from a location_run resource.

Parameter

locationRunName

String

A fully-qualified path representing a location_run resources.

Returns

String 

  • A string representing the run.

matchRunFromRunName

matchRunFromRunName(runName) returns String

Parse the runName from a run resource.

Parameter

runName

String

A fully-qualified path representing a run resources.

Returns

String 

  • A string representing the run.

matchTransferConfigFromLocationRunName

matchTransferConfigFromLocationRunName(locationRunName) returns String

Parse the locationRunName from a location_run resource.

Parameter

locationRunName

String

A fully-qualified path representing a location_run resources.

Returns

String 

  • A string representing the transfer_config.

matchTransferConfigFromLocationTransferConfigName

matchTransferConfigFromLocationTransferConfigName(locationTransferConfigName) returns String

Parse the locationTransferConfigName from a location_transfer_config resource.

Parameter

locationTransferConfigName

String

A fully-qualified path representing a location_transfer_config resources.

Returns

String 

  • A string representing the transfer_config.

matchTransferConfigFromRunName

matchTransferConfigFromRunName(runName) returns String

Parse the runName from a run resource.

Parameter

runName

String

A fully-qualified path representing a run resources.

Returns

String 

  • A string representing the transfer_config.

matchTransferConfigFromTransferConfigName

matchTransferConfigFromTransferConfigName(transferConfigName) returns String

Parse the transferConfigName from a transfer_config resource.

Parameter

transferConfigName

String

A fully-qualified path representing a transfer_config resources.

Returns

String 

  • A string representing the transfer_config.

projectPath

projectPath(project) returns String

Return a fully-qualified project resource name string.

Parameter

project

String

Returns

String 

runPath

runPath(project, transferConfig, run) returns String

Return a fully-qualified run resource name string.

Parameter

project

String

transferConfig

String

run

String

Returns

String 

scheduleTransferRuns

scheduleTransferRuns(request, options, callback) returns 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.

Parameter

request

Object

The request object that will be sent.

Values in request have the following properties:

Parameter

parent

string

Transfer configuration name in the form: projects/{project_id}/transferConfigs/{config_id}.

startTime

Object

Start time of the range of transfer runs. For example, "2017-05-25T00:00:00+00:00".

This object should have the same structure as Timestamp

endTime

Object

End time of the range of transfer runs. For example, "2017-05-30T00:00:00+00:00".

This object should have the same structure as Timestamp

options

Optional

Object

Optional parameters. You can override the default settings for this call, e.g, timeout, retries, paginations, etc. See gax.CallOptions for the details.

callback

Optional

function(nullable Error, nullable Object)

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.

Example

const bigqueryDataTransfer = require('@google-cloud/bigquery-data-transfer');

var client = new bigqueryDataTransfer.v1.DataTransferServiceClient({
  // optional auth parameters.
});

var formattedParent = client.locationTransferConfigPath('[PROJECT]', '[LOCATION]', '[TRANSFER_CONFIG]');
var startTime = {};
var endTime = {};
var request = {
  parent: formattedParent,
  startTime: startTime,
  endTime: endTime,
};
client.scheduleTransferRuns(request)
  .then(responses => {
    var response = responses[0];
    // doThingsWith(response)
  })
  .catch(err => {
    console.error(err);
  });

transferConfigPath

transferConfigPath(project, transferConfig) returns String

Return a fully-qualified transfer_config resource name string.

Parameter

project

String

transferConfig

String

Returns

String 

updateTransferConfig

updateTransferConfig(request, options, callback) returns Promise

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

Parameter

request

Object

The request object that will be sent.

Values in request have the following properties:

Parameter

transferConfig

Object

Data transfer configuration to create.

This object should have the same structure as TransferConfig

updateMask

Object

Required list of fields to be updated in this request.

This object should have the same structure as FieldMask

authorizationCode

Optional

string

Optional OAuth2 authorization code to use with this transfer configuration. If it is provided, the transfer configuration will be associated with the authorizing user. In order to obtain authorization_code, please make a request to https:// www.gstatic.com/bigquerydatatransfer/oauthz/auth?client_id= &scope=<data_source_scopes>&redirect_uri=<redirect_uri>

  • client_id should be OAuth client_id of BigQuery DTS API for the given data source returned by ListDataSources method.
  • data_source_scopes are the scopes returned by ListDataSources method.
  • redirect_uri is an optional parameter. If not specified, then authorization code is posted to the opener of authorization flow window. Otherwise it will be sent to the redirect uri. A special value of urn:ietf:wg:oauth:2.0:oob means that authorization code should be returned in the title bar of the browser, with the page text prompting the user to copy the code and paste it in the application.

options

Optional

Object

Optional parameters. You can override the default settings for this call, e.g, timeout, retries, paginations, etc. See gax.CallOptions for the details.

callback

Optional

function(nullable Error, nullable Object)

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.

Example

const bigqueryDataTransfer = require('@google-cloud/bigquery-data-transfer');

var client = new bigqueryDataTransfer.v1.DataTransferServiceClient({
  // optional auth parameters.
});

var transferConfig = {};
var updateMask = {};
var request = {
  transferConfig: transferConfig,
  updateMask: updateMask,
};
client.updateTransferConfig(request)
  .then(responses => {
    var response = responses[0];
    // doThingsWith(response)
  })
  .catch(err => {
    console.error(err);
  });