Methods

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 options have the following properties:

Name Type Optional Description

credentials

 

Yes

Credentials object.

credentials.client_email

 

Yes

credentials.private_key

 

Yes

email

 

Yes

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

keyFilename

 

Yes

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 below is not necessary. NOTE: .pem and .p12 require you to specify options.email as well.

port

 

Yes

The port on which to connect to the remote host.

projectId

 

Yes

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

 

Yes

Custom promise module to use instead of native Promises.

servicePath

 

Yes

The domain name of the API remote host.

Properties

static

apiEndpoint

The DNS address for this API service - same as servicePath(), exists for compatibility reasons.

static

port

The port for this API service.

static

scopes

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

static

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 request have the following properties:

Name Type Optional Description

name

string

 

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

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 request have the following properties:

Name Type Optional Description

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

string

Yes

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.

versionInfo

string

Yes

Optional version info. If users want to find a very recent access token, that is, immediately after approving access, users have to set the version_info claim in the token request. To obtain the version_info, users must use the "none+gsession" response type. which be return a version_info back in the authorization response which be be put in a JWT claim in the token request.

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 request have the following properties:

Name Type Optional Description

name

string

 

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

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 request have the following properties:

Name Type Optional Description

name

string

 

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

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 request have the following properties:

Name Type Optional Description

name

string

Yes

The name of the project resource in the form: projects/{project_id}

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 request have the following properties:

Name Type Optional Description

name

string

 

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

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 request have the following properties:

Name Type Optional Description

name

string

 

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

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 request have the following properties:

Name Type Optional Description

name

string

 

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

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 request have the following properties:

Name Type Optional Description

name

string

Yes

The name of the project resource in the form: projects/{project_id}

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 request have the following properties:

Name Type Optional Description

parent

string

 

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

pageSize

number

Yes

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

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 request have the following properties:

Name Type Optional Description

parent

string

 

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

pageSize

number

Yes

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

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

Stream 

An 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 request have the following properties:

Name Type Optional Description

parent

string

 

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

dataSourceIds

Array of string

Yes

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

pageSize

number

Yes

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

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 request have the following properties:

Name Type Optional Description

parent

string

 

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

dataSourceIds

Array of string

Yes

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

pageSize

number

Yes

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

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

Stream 

An 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 request have the following properties:

Name Type Optional Description

parent

string

 

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

pageSize

number

Yes

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

Array of number

Yes

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

The number should be among the values of MessageSeverity

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 request have the following properties:

Name Type Optional Description

parent

string

 

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

pageSize

number

Yes

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

Array of number

Yes

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

The number should be among the values of MessageSeverity

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

Stream 

An 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 request have the following properties:

Name Type Optional Description

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

Array of number

Yes

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

The number should be among the values of TransferState

pageSize

number

Yes

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

number

Yes

Indicates how run attempts are to be pulled.

The number should be among the values of RunAttempt

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 request have the following properties:

Name Type Optional Description

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

Array of number

Yes

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

The number should be among the values of TransferState

pageSize

number

Yes

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

number

Yes

Indicates how run attempts are to be pulled.

The number should be among the values of RunAttempt

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

Stream 

An 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 request have the following properties:

Name Type Optional Description

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

labels

Object with string properties

Yes

User labels to add to the scheduled runs.

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 request have the following properties:

Name Type Optional Description

parent

string

Yes

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

labels

Object with string properties

Yes

User labels to add to the backfilled runs.

requestedTimeRange

Object

Yes

Time range for the transfer runs that should be started.

This object should have the same structure as TimeRange

requestedRunTime

Object

Yes

Specific run_time for a transfer run to be started. The requested_run_time must not be in the future.

This object should have the same structure as Timestamp

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 request have the following properties:

Name Type Optional Description

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

string

Yes

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.

versionInfo

string

Yes

Optional version info. If users want to find a very recent access token, that is, immediately after approving access, users have to set the version_info claim in the token request. To obtain the version_info, users must use the "none+gsession" response type. which be return a version_info back in the authorization response which be be put in a JWT claim in the token request.

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.