Reference documentation and code samples for the BigQuery Data Transfer V1 Client class DataTransferServiceClient.
Service Description: This API allows users to manage their data transfers into BigQuery.
This class provides the ability to make remote calls to the backing service through method calls that map to API methods. Sample code to get started:
$dataTransferServiceClient = new DataTransferServiceClient();
try {
$formattedName = $dataTransferServiceClient->dataSourceName('[PROJECT]', '[DATA_SOURCE]');
$response = $dataTransferServiceClient->checkValidCreds($formattedName);
} finally {
$dataTransferServiceClient->close();
}
Many parameters require resource names to be formatted in a particular way. To assist with these names, this class includes a format method for each type of name, and additionally a parseName method to extract the individual identifiers contained within formatted names that are returned by the API.
This service has a new (beta) implementation. See Google\Cloud\BigQuery\DataTransfer\V1\Client\DataTransferServiceClient to use the new surface.
Namespace
Google \ Cloud \ BigQuery \ DataTransfer \ V1Methods
__construct
Constructor.
Parameters | |
---|---|
Name | Description |
options |
array
Optional. Options for configuring the service API wrapper. |
↳ apiEndpoint |
string
The address of the API remote host. May optionally include the port, formatted as "
|
↳ credentials |
string|array|FetchAuthTokenInterface|CredentialsWrapper
The credentials to be used by the client to authorize API calls. This option accepts either a path to a credentials file, or a decoded credentials file as a PHP array. Advanced usage: In addition, this option can also accept a pre-constructed Google\Auth\FetchAuthTokenInterface object or Google\ApiCore\CredentialsWrapper object. Note that when one of these objects are provided, any settings in $credentialsConfig will be ignored. |
↳ credentialsConfig |
array
Options used to configure credentials, including auth token caching, for the client. For a full list of supporting configuration options, see Google\ApiCore\CredentialsWrapper::build() . |
↳ disableRetries |
bool
Determines whether or not retries defined by the client configuration should be disabled. Defaults to |
↳ clientConfig |
string|array
Client method configuration, including retry settings. This option can be either a path to a JSON file, or a PHP array containing the decoded JSON data. By default this settings points to the default client config file, which is provided in the resources folder. |
↳ transport |
string|TransportInterface
The transport used for executing network requests. May be either the string |
↳ transportConfig |
array
Configuration options that will be used to construct the transport. Options for each supported transport type should be passed in a key for that transport. For example: $transportConfig = [ 'grpc' => [...], 'rest' => [...], ]; See the Google\ApiCore\Transport\GrpcTransport::build() and Google\ApiCore\Transport\RestTransport::build() methods for the supported options. |
↳ clientCertSource |
callable
A callable which returns the client cert as a string. This can be used to provide a certificate and private key to the transport layer for mTLS. |
checkValidCreds
Returns true if valid credentials exist for the given data source and requesting user.
Parameters | |
---|---|
Name | Description |
name |
string
Required. The data source in the form:
|
optionalArgs |
array
Optional. |
↳ retrySettings |
RetrySettings|array
Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage. |
Returns | |
---|---|
Type | Description |
Google\Cloud\BigQuery\DataTransfer\V1\CheckValidCredsResponse |
use Google\ApiCore\ApiException;
use Google\Cloud\BigQuery\DataTransfer\V1\CheckValidCredsResponse;
use Google\Cloud\BigQuery\DataTransfer\V1\DataTransferServiceClient;
/**
* @param string $formattedName The data source in the form:
* `projects/{project_id}/dataSources/{data_source_id}` or
* `projects/{project_id}/locations/{location_id}/dataSources/{data_source_id}`. Please see
* {@see DataTransferServiceClient::dataSourceName()} for help formatting this field.
*/
function check_valid_creds_sample(string $formattedName): void
{
// Create a client.
$dataTransferServiceClient = new DataTransferServiceClient();
// Call the API and handle any network failures.
try {
/** @var CheckValidCredsResponse $response */
$response = $dataTransferServiceClient->checkValidCreds($formattedName);
printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString());
} catch (ApiException $ex) {
printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
}
}
/**
* Helper to execute the sample.
*
* This sample has been automatically generated and should be regarded as a code
* template only. It will require modifications to work:
* - It may require correct/in-range values for request initialization.
* - It may require specifying regional endpoints when creating the service client,
* please see the apiEndpoint client configuration option for more details.
*/
function callSample(): void
{
$formattedName = DataTransferServiceClient::dataSourceName('[PROJECT]', '[DATA_SOURCE]');
check_valid_creds_sample($formattedName);
}
createTransferConfig
Creates a new data transfer configuration.
Parameters | |
---|---|
Name | Description |
parent |
string
Required. The BigQuery project id where the transfer configuration should be created. Must be in the format projects/{project_id}/locations/{location_id} or projects/{project_id}. If specified location and location of the destination bigquery dataset do not match - the request will fail. |
transferConfig |
Google\Cloud\BigQuery\DataTransfer\V1\TransferConfig
Required. Data transfer configuration to create. |
optionalArgs |
array
Optional. |
↳ authorizationCode |
string
Optional OAuth2 authorization code to use with this transfer configuration. This is required only if https://www.gstatic.com/bigquerydatatransfer/oauthz/auth?redirect_uri=urn:ietf:wg:oauth:2.0:oob&response_type=authorization_code&client_id=client_id&scope=data_source_scopes* The client_id is the OAuth client_id of the a data source as returned by ListDataSources method. * data_source_scopes are the scopes returned by ListDataSources method. Note that this should not be set when service_account_name is used to create the transfer config.
|
↳ versionInfo |
string
Optional version info. This is required only if https://www.gstatic.com/bigquerydatatransfer/oauthz/auth?redirect_uri=urn:ietf:wg:oauth:2.0:oob&response_type=version_info&client_id=client_id&scope=data_source_scopes* The client_id is the OAuth client_id of the a data source as returned by ListDataSources method. * data_source_scopes are the scopes returned by ListDataSources method. Note that this should not be set when service_account_name is used to create the transfer config.
|
↳ serviceAccountName |
string
Optional service account email. If this field is set, the transfer config will be created with this service account's credentials. It requires that the requesting user calling this API has permissions to act as this service account. Note that not all data sources support service account credentials when creating a transfer config. For the latest list of data sources, read about using service accounts. |
↳ retrySettings |
RetrySettings|array
Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage. |
Returns | |
---|---|
Type | Description |
Google\Cloud\BigQuery\DataTransfer\V1\TransferConfig |
use Google\ApiCore\ApiException;
use Google\Cloud\BigQuery\DataTransfer\V1\DataTransferServiceClient;
use Google\Cloud\BigQuery\DataTransfer\V1\TransferConfig;
/**
* @param string $formattedParent The BigQuery project id where the transfer configuration should
* be created. Must be in the format
* projects/{project_id}/locations/{location_id} or projects/{project_id}. If
* specified location and location of the destination bigquery dataset do not
* match - the request will fail. Please see
* {@see DataTransferServiceClient::projectName()} for help formatting this field.
*/
function create_transfer_config_sample(string $formattedParent): void
{
// Create a client.
$dataTransferServiceClient = new DataTransferServiceClient();
// Prepare any non-scalar elements to be passed along with the request.
$transferConfig = new TransferConfig();
// Call the API and handle any network failures.
try {
/** @var TransferConfig $response */
$response = $dataTransferServiceClient->createTransferConfig($formattedParent, $transferConfig);
printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString());
} catch (ApiException $ex) {
printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
}
}
/**
* Helper to execute the sample.
*
* This sample has been automatically generated and should be regarded as a code
* template only. It will require modifications to work:
* - It may require correct/in-range values for request initialization.
* - It may require specifying regional endpoints when creating the service client,
* please see the apiEndpoint client configuration option for more details.
*/
function callSample(): void
{
$formattedParent = DataTransferServiceClient::projectName('[PROJECT]');
create_transfer_config_sample($formattedParent);
}
deleteTransferConfig
Deletes a data transfer configuration, including any associated transfer runs and logs.
Parameters | |
---|---|
Name | Description |
name |
string
Required. The field will contain name of the resource requested, for
example: |
optionalArgs |
array
Optional. |
↳ retrySettings |
RetrySettings|array
Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage. |
use Google\ApiCore\ApiException;
use Google\Cloud\BigQuery\DataTransfer\V1\DataTransferServiceClient;
/**
* @param string $formattedName The field will contain name of the resource requested, for
* example: `projects/{project_id}/transferConfigs/{config_id}` or
* `projects/{project_id}/locations/{location_id}/transferConfigs/{config_id}`
* Please see {@see DataTransferServiceClient::transferConfigName()} for help formatting this field.
*/
function delete_transfer_config_sample(string $formattedName): void
{
// Create a client.
$dataTransferServiceClient = new DataTransferServiceClient();
// Call the API and handle any network failures.
try {
$dataTransferServiceClient->deleteTransferConfig($formattedName);
printf('Call completed successfully.' . PHP_EOL);
} catch (ApiException $ex) {
printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
}
}
/**
* Helper to execute the sample.
*
* This sample has been automatically generated and should be regarded as a code
* template only. It will require modifications to work:
* - It may require correct/in-range values for request initialization.
* - It may require specifying regional endpoints when creating the service client,
* please see the apiEndpoint client configuration option for more details.
*/
function callSample(): void
{
$formattedName = DataTransferServiceClient::transferConfigName('[PROJECT]', '[TRANSFER_CONFIG]');
delete_transfer_config_sample($formattedName);
}
deleteTransferRun
Deletes the specified transfer run.
Parameters | |
---|---|
Name | Description |
name |
string
Required. The field will contain name of the resource requested, for
example: |
optionalArgs |
array
Optional. |
↳ retrySettings |
RetrySettings|array
Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage. |
use Google\ApiCore\ApiException;
use Google\Cloud\BigQuery\DataTransfer\V1\DataTransferServiceClient;
/**
* @param string $formattedName The field will contain name of the resource requested, for
* example: `projects/{project_id}/transferConfigs/{config_id}/runs/{run_id}`
* or
* `projects/{project_id}/locations/{location_id}/transferConfigs/{config_id}/runs/{run_id}`
* Please see {@see DataTransferServiceClient::runName()} for help formatting this field.
*/
function delete_transfer_run_sample(string $formattedName): void
{
// Create a client.
$dataTransferServiceClient = new DataTransferServiceClient();
// Call the API and handle any network failures.
try {
$dataTransferServiceClient->deleteTransferRun($formattedName);
printf('Call completed successfully.' . PHP_EOL);
} catch (ApiException $ex) {
printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
}
}
/**
* Helper to execute the sample.
*
* This sample has been automatically generated and should be regarded as a code
* template only. It will require modifications to work:
* - It may require correct/in-range values for request initialization.
* - It may require specifying regional endpoints when creating the service client,
* please see the apiEndpoint client configuration option for more details.
*/
function callSample(): void
{
$formattedName = DataTransferServiceClient::runName('[PROJECT]', '[TRANSFER_CONFIG]', '[RUN]');
delete_transfer_run_sample($formattedName);
}
enrollDataSources
Enroll data sources in a user project. This allows users to create transfer configurations for these data sources. They will also appear in the ListDataSources RPC and as such, will appear in the BigQuery UI, and the documents can be found in the public guide for BigQuery Web UI and Data Transfer Service.
Parameters | |
---|---|
Name | Description |
optionalArgs |
array
Optional. |
↳ name |
string
The name of the project resource in the form: |
↳ dataSourceIds |
string[]
Data sources that are enrolled. It is required to provide at least one data source id. |
↳ retrySettings |
RetrySettings|array
Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage. |
use Google\ApiCore\ApiException;
use Google\Cloud\BigQuery\DataTransfer\V1\DataTransferServiceClient;
/**
* This sample has been automatically generated and should be regarded as a code
* template only. It will require modifications to work:
* - It may require correct/in-range values for request initialization.
* - It may require specifying regional endpoints when creating the service client,
* please see the apiEndpoint client configuration option for more details.
*/
function enroll_data_sources_sample(): void
{
// Create a client.
$dataTransferServiceClient = new DataTransferServiceClient();
// Call the API and handle any network failures.
try {
$dataTransferServiceClient->enrollDataSources();
printf('Call completed successfully.' . PHP_EOL);
} catch (ApiException $ex) {
printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
}
}
getDataSource
Retrieves a supported data source and returns its settings.
Parameters | |
---|---|
Name | Description |
name |
string
Required. The field will contain name of the resource requested, for
example: |
optionalArgs |
array
Optional. |
↳ retrySettings |
RetrySettings|array
Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage. |
Returns | |
---|---|
Type | Description |
Google\Cloud\BigQuery\DataTransfer\V1\DataSource |
use Google\ApiCore\ApiException;
use Google\Cloud\BigQuery\DataTransfer\V1\DataSource;
use Google\Cloud\BigQuery\DataTransfer\V1\DataTransferServiceClient;
/**
* @param string $formattedName The field will contain name of the resource requested, for
* example: `projects/{project_id}/dataSources/{data_source_id}` or
* `projects/{project_id}/locations/{location_id}/dataSources/{data_source_id}`
* Please see {@see DataTransferServiceClient::dataSourceName()} for help formatting this field.
*/
function get_data_source_sample(string $formattedName): void
{
// Create a client.
$dataTransferServiceClient = new DataTransferServiceClient();
// Call the API and handle any network failures.
try {
/** @var DataSource $response */
$response = $dataTransferServiceClient->getDataSource($formattedName);
printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString());
} catch (ApiException $ex) {
printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
}
}
/**
* Helper to execute the sample.
*
* This sample has been automatically generated and should be regarded as a code
* template only. It will require modifications to work:
* - It may require correct/in-range values for request initialization.
* - It may require specifying regional endpoints when creating the service client,
* please see the apiEndpoint client configuration option for more details.
*/
function callSample(): void
{
$formattedName = DataTransferServiceClient::dataSourceName('[PROJECT]', '[DATA_SOURCE]');
get_data_source_sample($formattedName);
}
getTransferConfig
Returns information about a data transfer config.
Parameters | |
---|---|
Name | Description |
name |
string
Required. The field will contain name of the resource requested, for
example: |
optionalArgs |
array
Optional. |
↳ retrySettings |
RetrySettings|array
Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage. |
Returns | |
---|---|
Type | Description |
Google\Cloud\BigQuery\DataTransfer\V1\TransferConfig |
use Google\ApiCore\ApiException;
use Google\Cloud\BigQuery\DataTransfer\V1\DataTransferServiceClient;
use Google\Cloud\BigQuery\DataTransfer\V1\TransferConfig;
/**
* @param string $formattedName The field will contain name of the resource requested, for
* example: `projects/{project_id}/transferConfigs/{config_id}` or
* `projects/{project_id}/locations/{location_id}/transferConfigs/{config_id}`
* Please see {@see DataTransferServiceClient::transferConfigName()} for help formatting this field.
*/
function get_transfer_config_sample(string $formattedName): void
{
// Create a client.
$dataTransferServiceClient = new DataTransferServiceClient();
// Call the API and handle any network failures.
try {
/** @var TransferConfig $response */
$response = $dataTransferServiceClient->getTransferConfig($formattedName);
printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString());
} catch (ApiException $ex) {
printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
}
}
/**
* Helper to execute the sample.
*
* This sample has been automatically generated and should be regarded as a code
* template only. It will require modifications to work:
* - It may require correct/in-range values for request initialization.
* - It may require specifying regional endpoints when creating the service client,
* please see the apiEndpoint client configuration option for more details.
*/
function callSample(): void
{
$formattedName = DataTransferServiceClient::transferConfigName('[PROJECT]', '[TRANSFER_CONFIG]');
get_transfer_config_sample($formattedName);
}
getTransferRun
Returns information about the particular transfer run.
Parameters | |
---|---|
Name | Description |
name |
string
Required. The field will contain name of the resource requested, for
example: |
optionalArgs |
array
Optional. |
↳ retrySettings |
RetrySettings|array
Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage. |
Returns | |
---|---|
Type | Description |
Google\Cloud\BigQuery\DataTransfer\V1\TransferRun |
use Google\ApiCore\ApiException;
use Google\Cloud\BigQuery\DataTransfer\V1\DataTransferServiceClient;
use Google\Cloud\BigQuery\DataTransfer\V1\TransferRun;
/**
* @param string $formattedName The field will contain name of the resource requested, for
* example: `projects/{project_id}/transferConfigs/{config_id}/runs/{run_id}`
* or
* `projects/{project_id}/locations/{location_id}/transferConfigs/{config_id}/runs/{run_id}`
* Please see {@see DataTransferServiceClient::runName()} for help formatting this field.
*/
function get_transfer_run_sample(string $formattedName): void
{
// Create a client.
$dataTransferServiceClient = new DataTransferServiceClient();
// Call the API and handle any network failures.
try {
/** @var TransferRun $response */
$response = $dataTransferServiceClient->getTransferRun($formattedName);
printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString());
} catch (ApiException $ex) {
printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
}
}
/**
* Helper to execute the sample.
*
* This sample has been automatically generated and should be regarded as a code
* template only. It will require modifications to work:
* - It may require correct/in-range values for request initialization.
* - It may require specifying regional endpoints when creating the service client,
* please see the apiEndpoint client configuration option for more details.
*/
function callSample(): void
{
$formattedName = DataTransferServiceClient::runName('[PROJECT]', '[TRANSFER_CONFIG]', '[RUN]');
get_transfer_run_sample($formattedName);
}
listDataSources
Lists supported data sources and returns their settings.
Parameters | |
---|---|
Name | Description |
parent |
string
Required. The BigQuery project id for which data sources should be
returned. Must be in the form: |
optionalArgs |
array
Optional. |
↳ pageToken |
string
A page token is used to specify a page of values to be returned. If no page token is specified (the default), the first page of values will be returned. Any page token used here must have been generated by a previous call to the API. |
↳ pageSize |
int
The maximum number of resources contained in the underlying API response. The API may return fewer values in a page, even if there are additional values to be retrieved. |
↳ retrySettings |
RetrySettings|array
Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage. |
Returns | |
---|---|
Type | Description |
Google\ApiCore\PagedListResponse |
use Google\ApiCore\ApiException;
use Google\ApiCore\PagedListResponse;
use Google\Cloud\BigQuery\DataTransfer\V1\DataSource;
use Google\Cloud\BigQuery\DataTransfer\V1\DataTransferServiceClient;
/**
* @param string $formattedParent The BigQuery project id for which data sources should be
* returned. Must be in the form: `projects/{project_id}` or
* `projects/{project_id}/locations/{location_id}`
* Please see {@see DataTransferServiceClient::projectName()} for help formatting this field.
*/
function list_data_sources_sample(string $formattedParent): void
{
// Create a client.
$dataTransferServiceClient = new DataTransferServiceClient();
// Call the API and handle any network failures.
try {
/** @var PagedListResponse $response */
$response = $dataTransferServiceClient->listDataSources($formattedParent);
/** @var DataSource $element */
foreach ($response as $element) {
printf('Element data: %s' . PHP_EOL, $element->serializeToJsonString());
}
} catch (ApiException $ex) {
printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
}
}
/**
* Helper to execute the sample.
*
* This sample has been automatically generated and should be regarded as a code
* template only. It will require modifications to work:
* - It may require correct/in-range values for request initialization.
* - It may require specifying regional endpoints when creating the service client,
* please see the apiEndpoint client configuration option for more details.
*/
function callSample(): void
{
$formattedParent = DataTransferServiceClient::projectName('[PROJECT]');
list_data_sources_sample($formattedParent);
}
listTransferConfigs
Returns information about all transfer configs owned by a project in the specified location.
Parameters | |
---|---|
Name | Description |
parent |
string
Required. The BigQuery project id for which transfer configs
should be returned: |
optionalArgs |
array
Optional. |
↳ dataSourceIds |
string[]
When specified, only configurations of requested data sources are returned. |
↳ pageToken |
string
A page token is used to specify a page of values to be returned. If no page token is specified (the default), the first page of values will be returned. Any page token used here must have been generated by a previous call to the API. |
↳ pageSize |
int
The maximum number of resources contained in the underlying API response. The API may return fewer values in a page, even if there are additional values to be retrieved. |
↳ retrySettings |
RetrySettings|array
Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage. |
Returns | |
---|---|
Type | Description |
Google\ApiCore\PagedListResponse |
use Google\ApiCore\ApiException;
use Google\ApiCore\PagedListResponse;
use Google\Cloud\BigQuery\DataTransfer\V1\DataTransferServiceClient;
use Google\Cloud\BigQuery\DataTransfer\V1\TransferConfig;
/**
* @param string $formattedParent The BigQuery project id for which transfer configs
* should be returned: `projects/{project_id}` or
* `projects/{project_id}/locations/{location_id}`
* Please see {@see DataTransferServiceClient::projectName()} for help formatting this field.
*/
function list_transfer_configs_sample(string $formattedParent): void
{
// Create a client.
$dataTransferServiceClient = new DataTransferServiceClient();
// Call the API and handle any network failures.
try {
/** @var PagedListResponse $response */
$response = $dataTransferServiceClient->listTransferConfigs($formattedParent);
/** @var TransferConfig $element */
foreach ($response as $element) {
printf('Element data: %s' . PHP_EOL, $element->serializeToJsonString());
}
} catch (ApiException $ex) {
printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
}
}
/**
* Helper to execute the sample.
*
* This sample has been automatically generated and should be regarded as a code
* template only. It will require modifications to work:
* - It may require correct/in-range values for request initialization.
* - It may require specifying regional endpoints when creating the service client,
* please see the apiEndpoint client configuration option for more details.
*/
function callSample(): void
{
$formattedParent = DataTransferServiceClient::projectName('[PROJECT]');
list_transfer_configs_sample($formattedParent);
}
listTransferLogs
Returns log messages for the transfer run.
Parameters | |
---|---|
Name | Description |
parent |
string
Required. Transfer run name in the form:
|
optionalArgs |
array
Optional. |
↳ pageToken |
string
A page token is used to specify a page of values to be returned. If no page token is specified (the default), the first page of values will be returned. Any page token used here must have been generated by a previous call to the API. |
↳ pageSize |
int
The maximum number of resources contained in the underlying API response. The API may return fewer values in a page, even if there are additional values to be retrieved. |
↳ messageTypes |
int[]
Message types to return. If not populated - INFO, WARNING and ERROR messages are returned. For allowed values, use constants defined on Google\Cloud\BigQuery\DataTransfer\V1\TransferMessage\MessageSeverity |
↳ retrySettings |
RetrySettings|array
Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage. |
Returns | |
---|---|
Type | Description |
Google\ApiCore\PagedListResponse |
use Google\ApiCore\ApiException;
use Google\ApiCore\PagedListResponse;
use Google\Cloud\BigQuery\DataTransfer\V1\DataTransferServiceClient;
use Google\Cloud\BigQuery\DataTransfer\V1\TransferMessage;
/**
* @param string $formattedParent Transfer run name in the form:
* `projects/{project_id}/transferConfigs/{config_id}/runs/{run_id}` or
* `projects/{project_id}/locations/{location_id}/transferConfigs/{config_id}/runs/{run_id}`
* Please see {@see DataTransferServiceClient::runName()} for help formatting this field.
*/
function list_transfer_logs_sample(string $formattedParent): void
{
// Create a client.
$dataTransferServiceClient = new DataTransferServiceClient();
// Call the API and handle any network failures.
try {
/** @var PagedListResponse $response */
$response = $dataTransferServiceClient->listTransferLogs($formattedParent);
/** @var TransferMessage $element */
foreach ($response as $element) {
printf('Element data: %s' . PHP_EOL, $element->serializeToJsonString());
}
} catch (ApiException $ex) {
printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
}
}
/**
* Helper to execute the sample.
*
* This sample has been automatically generated and should be regarded as a code
* template only. It will require modifications to work:
* - It may require correct/in-range values for request initialization.
* - It may require specifying regional endpoints when creating the service client,
* please see the apiEndpoint client configuration option for more details.
*/
function callSample(): void
{
$formattedParent = DataTransferServiceClient::runName('[PROJECT]', '[TRANSFER_CONFIG]', '[RUN]');
list_transfer_logs_sample($formattedParent);
}
listTransferRuns
Returns information about running and completed transfer runs.
Parameters | |
---|---|
Name | Description |
parent |
string
Required. Name of transfer configuration for which transfer runs should be
retrieved. Format of transfer configuration resource name is:
|
optionalArgs |
array
Optional. |
↳ states |
int[]
When specified, only transfer runs with requested states are returned. For allowed values, use constants defined on Google\Cloud\BigQuery\DataTransfer\V1\TransferState |
↳ pageToken |
string
A page token is used to specify a page of values to be returned. If no page token is specified (the default), the first page of values will be returned. Any page token used here must have been generated by a previous call to the API. |
↳ pageSize |
int
The maximum number of resources contained in the underlying API response. The API may return fewer values in a page, even if there are additional values to be retrieved. |
↳ runAttempt |
int
Indicates how run attempts are to be pulled. For allowed values, use constants defined on Google\Cloud\BigQuery\DataTransfer\V1\ListTransferRunsRequest\RunAttempt |
↳ retrySettings |
RetrySettings|array
Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage. |
Returns | |
---|---|
Type | Description |
Google\ApiCore\PagedListResponse |
use Google\ApiCore\ApiException;
use Google\ApiCore\PagedListResponse;
use Google\Cloud\BigQuery\DataTransfer\V1\DataTransferServiceClient;
use Google\Cloud\BigQuery\DataTransfer\V1\TransferRun;
/**
* @param string $formattedParent Name of transfer configuration for which transfer runs should be
* retrieved. Format of transfer configuration resource name is:
* `projects/{project_id}/transferConfigs/{config_id}` or
* `projects/{project_id}/locations/{location_id}/transferConfigs/{config_id}`. Please see
* {@see DataTransferServiceClient::transferConfigName()} for help formatting this field.
*/
function list_transfer_runs_sample(string $formattedParent): void
{
// Create a client.
$dataTransferServiceClient = new DataTransferServiceClient();
// Call the API and handle any network failures.
try {
/** @var PagedListResponse $response */
$response = $dataTransferServiceClient->listTransferRuns($formattedParent);
/** @var TransferRun $element */
foreach ($response as $element) {
printf('Element data: %s' . PHP_EOL, $element->serializeToJsonString());
}
} catch (ApiException $ex) {
printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
}
}
/**
* Helper to execute the sample.
*
* This sample has been automatically generated and should be regarded as a code
* template only. It will require modifications to work:
* - It may require correct/in-range values for request initialization.
* - It may require specifying regional endpoints when creating the service client,
* please see the apiEndpoint client configuration option for more details.
*/
function callSample(): void
{
$formattedParent = DataTransferServiceClient::transferConfigName('[PROJECT]', '[TRANSFER_CONFIG]');
list_transfer_runs_sample($formattedParent);
}
scheduleTransferRuns
Creates transfer runs for a time range [start_time, end_time].
For each date - or whatever granularity the data source supports - in the range, one transfer run is created. Note that runs are created per UTC time in the time range. DEPRECATED: use StartManualTransferRuns instead.
Parameters | |
---|---|
Name | Description |
parent |
string
Required. Transfer configuration name in the form:
|
startTime |
Google\Protobuf\Timestamp
Required. Start time of the range of transfer runs. For example,
|
endTime |
Google\Protobuf\Timestamp
Required. End time of the range of transfer runs. For example,
|
optionalArgs |
array
Optional. |
↳ retrySettings |
RetrySettings|array
Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage. |
Returns | |
---|---|
Type | Description |
Google\Cloud\BigQuery\DataTransfer\V1\ScheduleTransferRunsResponse |
use Google\ApiCore\ApiException;
use Google\Cloud\BigQuery\DataTransfer\V1\DataTransferServiceClient;
use Google\Cloud\BigQuery\DataTransfer\V1\ScheduleTransferRunsResponse;
use Google\Protobuf\Timestamp;
/**
* @param string $formattedParent Transfer configuration name in the form:
* `projects/{project_id}/transferConfigs/{config_id}` or
* `projects/{project_id}/locations/{location_id}/transferConfigs/{config_id}`. Please see
* {@see DataTransferServiceClient::transferConfigName()} for help formatting this field.
*/
function schedule_transfer_runs_sample(string $formattedParent): void
{
// Create a client.
$dataTransferServiceClient = new DataTransferServiceClient();
// Prepare any non-scalar elements to be passed along with the request.
$startTime = new Timestamp();
$endTime = new Timestamp();
// Call the API and handle any network failures.
try {
/** @var ScheduleTransferRunsResponse $response */
$response = $dataTransferServiceClient->scheduleTransferRuns(
$formattedParent,
$startTime,
$endTime
);
printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString());
} catch (ApiException $ex) {
printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
}
}
/**
* Helper to execute the sample.
*
* This sample has been automatically generated and should be regarded as a code
* template only. It will require modifications to work:
* - It may require correct/in-range values for request initialization.
* - It may require specifying regional endpoints when creating the service client,
* please see the apiEndpoint client configuration option for more details.
*/
function callSample(): void
{
$formattedParent = DataTransferServiceClient::transferConfigName('[PROJECT]', '[TRANSFER_CONFIG]');
schedule_transfer_runs_sample($formattedParent);
}
startManualTransferRuns
Start manual transfer runs to be executed now with schedule_time equal to current time. The transfer runs can be created for a time range where the run_time is between start_time (inclusive) and end_time (exclusive), or for a specific run_time.
Parameters | |
---|---|
Name | Description |
optionalArgs |
array
Optional. |
↳ parent |
string
Transfer configuration name in the form: |
↳ requestedTimeRange |
TimeRange
Time range for the transfer runs that should be started. |
↳ requestedRunTime |
Timestamp
Specific run_time for a transfer run to be started. The requested_run_time must not be in the future. |
↳ retrySettings |
RetrySettings|array
Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage. |
Returns | |
---|---|
Type | Description |
Google\Cloud\BigQuery\DataTransfer\V1\StartManualTransferRunsResponse |
use Google\ApiCore\ApiException;
use Google\Cloud\BigQuery\DataTransfer\V1\DataTransferServiceClient;
use Google\Cloud\BigQuery\DataTransfer\V1\StartManualTransferRunsResponse;
/**
* This sample has been automatically generated and should be regarded as a code
* template only. It will require modifications to work:
* - It may require correct/in-range values for request initialization.
* - It may require specifying regional endpoints when creating the service client,
* please see the apiEndpoint client configuration option for more details.
*/
function start_manual_transfer_runs_sample(): void
{
// Create a client.
$dataTransferServiceClient = new DataTransferServiceClient();
// Call the API and handle any network failures.
try {
/** @var StartManualTransferRunsResponse $response */
$response = $dataTransferServiceClient->startManualTransferRuns();
printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString());
} catch (ApiException $ex) {
printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
}
}
updateTransferConfig
Updates a data transfer configuration.
All fields must be set, even if they are not updated.
Parameters | |
---|---|
Name | Description |
transferConfig |
Google\Cloud\BigQuery\DataTransfer\V1\TransferConfig
Required. Data transfer configuration to create. |
updateMask |
Google\Protobuf\FieldMask
Required. Required list of fields to be updated in this request. |
optionalArgs |
array
Optional. |
↳ authorizationCode |
string
Optional OAuth2 authorization code to use with this transfer configuration. This is required only if https://www.gstatic.com/bigquerydatatransfer/oauthz/auth?redirect_uri=urn:ietf:wg:oauth:2.0:oob&response_type=authorization_code&client_id=client_id&scope=data_source_scopes* The client_id is the OAuth client_id of the a data source as returned by ListDataSources method. * data_source_scopes are the scopes returned by ListDataSources method. Note that this should not be set when service_account_name is used to update the transfer config.
|
↳ versionInfo |
string
Optional version info. This is required only if https://www.gstatic.com/bigquerydatatransfer/oauthz/auth?redirect_uri=urn:ietf:wg:oauth:2.0:oob&response_type=version_info&client_id=client_id&scope=data_source_scopes* The client_id is the OAuth client_id of the a data source as returned by ListDataSources method. * data_source_scopes are the scopes returned by ListDataSources method. Note that this should not be set when service_account_name is used to update the transfer config.
|
↳ serviceAccountName |
string
Optional service account email. If this field is set, the transfer config will be created with this service account's credentials. It requires that the requesting user calling this API has permissions to act as this service account. Note that not all data sources support service account credentials when creating a transfer config. For the latest list of data sources, read about using service accounts. |
↳ retrySettings |
RetrySettings|array
Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage. |
Returns | |
---|---|
Type | Description |
Google\Cloud\BigQuery\DataTransfer\V1\TransferConfig |
use Google\ApiCore\ApiException;
use Google\Cloud\BigQuery\DataTransfer\V1\DataTransferServiceClient;
use Google\Cloud\BigQuery\DataTransfer\V1\TransferConfig;
use Google\Protobuf\FieldMask;
/**
* This sample has been automatically generated and should be regarded as a code
* template only. It will require modifications to work:
* - It may require correct/in-range values for request initialization.
* - It may require specifying regional endpoints when creating the service client,
* please see the apiEndpoint client configuration option for more details.
*/
function update_transfer_config_sample(): void
{
// Create a client.
$dataTransferServiceClient = new DataTransferServiceClient();
// Prepare any non-scalar elements to be passed along with the request.
$transferConfig = new TransferConfig();
$updateMask = new FieldMask();
// Call the API and handle any network failures.
try {
/** @var TransferConfig $response */
$response = $dataTransferServiceClient->updateTransferConfig($transferConfig, $updateMask);
printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString());
} catch (ApiException $ex) {
printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
}
}
getLocation
Gets information about a location.
Parameters | |
---|---|
Name | Description |
optionalArgs |
array
Optional. |
↳ name |
string
Resource name for the location. |
↳ retrySettings |
RetrySettings|array
Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage. |
Returns | |
---|---|
Type | Description |
Google\Cloud\Location\Location |
use Google\ApiCore\ApiException;
use Google\Cloud\BigQuery\DataTransfer\V1\DataTransferServiceClient;
use Google\Cloud\Location\Location;
/**
* This sample has been automatically generated and should be regarded as a code
* template only. It will require modifications to work:
* - It may require correct/in-range values for request initialization.
* - It may require specifying regional endpoints when creating the service client,
* please see the apiEndpoint client configuration option for more details.
*/
function get_location_sample(): void
{
// Create a client.
$dataTransferServiceClient = new DataTransferServiceClient();
// Call the API and handle any network failures.
try {
/** @var Location $response */
$response = $dataTransferServiceClient->getLocation();
printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString());
} catch (ApiException $ex) {
printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
}
}
listLocations
Lists information about the supported locations for this service.
Parameters | |
---|---|
Name | Description |
optionalArgs |
array
Optional. |
↳ name |
string
The resource that owns the locations collection, if applicable. |
↳ filter |
string
The standard list filter. |
↳ pageSize |
int
The maximum number of resources contained in the underlying API response. The API may return fewer values in a page, even if there are additional values to be retrieved. |
↳ pageToken |
string
A page token is used to specify a page of values to be returned. If no page token is specified (the default), the first page of values will be returned. Any page token used here must have been generated by a previous call to the API. |
↳ retrySettings |
RetrySettings|array
Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage. |
Returns | |
---|---|
Type | Description |
Google\ApiCore\PagedListResponse |
use Google\ApiCore\ApiException;
use Google\ApiCore\PagedListResponse;
use Google\Cloud\BigQuery\DataTransfer\V1\DataTransferServiceClient;
use Google\Cloud\Location\Location;
/**
* This sample has been automatically generated and should be regarded as a code
* template only. It will require modifications to work:
* - It may require correct/in-range values for request initialization.
* - It may require specifying regional endpoints when creating the service client,
* please see the apiEndpoint client configuration option for more details.
*/
function list_locations_sample(): void
{
// Create a client.
$dataTransferServiceClient = new DataTransferServiceClient();
// Call the API and handle any network failures.
try {
/** @var PagedListResponse $response */
$response = $dataTransferServiceClient->listLocations();
/** @var Location $element */
foreach ($response as $element) {
printf('Element data: %s' . PHP_EOL, $element->serializeToJsonString());
}
} catch (ApiException $ex) {
printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
}
}
static::locationDataSourceName
Formats a string containing the fully-qualified path to represent a location_data_source resource.
Parameters | |
---|---|
Name | Description |
project |
string
|
location |
string
|
dataSource |
string
|
Returns | |
---|---|
Type | Description |
string | The formatted location_data_source resource. |
static::locationRunName
Formats a string containing the fully-qualified path to represent a location_run resource.
Parameters | |
---|---|
Name | Description |
project |
string
|
location |
string
|
transferConfig |
string
|
run |
string
|
Returns | |
---|---|
Type | Description |
string | The formatted location_run resource. |
static::locationTransferConfigName
Formats a string containing the fully-qualified path to represent a location_transfer_config resource.
Parameters | |
---|---|
Name | Description |
project |
string
|
location |
string
|
transferConfig |
string
|
Returns | |
---|---|
Type | Description |
string | The formatted location_transfer_config resource. |
static::projectRunName
Formats a string containing the fully-qualified path to represent a project_run resource.
Parameters | |
---|---|
Name | Description |
project |
string
|
transferConfig |
string
|
run |
string
|
Returns | |
---|---|
Type | Description |
string | The formatted project_run resource. |
static::dataSourceName
Formats a string containing the fully-qualified path to represent a data_source resource.
Parameters | |
---|---|
Name | Description |
project |
string
|
dataSource |
string
|
Returns | |
---|---|
Type | Description |
string | The formatted data_source resource. |
static::locationName
Formats a string containing the fully-qualified path to represent a location resource.
Parameters | |
---|---|
Name | Description |
project |
string
|
location |
string
|
Returns | |
---|---|
Type | Description |
string | The formatted location resource. |
static::projectName
Formats a string containing the fully-qualified path to represent a project resource.
Parameter | |
---|---|
Name | Description |
project |
string
|
Returns | |
---|---|
Type | Description |
string | The formatted project resource. |
static::projectDataSourceName
Formats a string containing the fully-qualified path to represent a project_data_source resource.
Parameters | |
---|---|
Name | Description |
project |
string
|
dataSource |
string
|
Returns | |
---|---|
Type | Description |
string | The formatted project_data_source resource. |
static::projectLocationDataSourceName
Formats a string containing the fully-qualified path to represent a project_location_data_source resource.
Parameters | |
---|---|
Name | Description |
project |
string
|
location |
string
|
dataSource |
string
|
Returns | |
---|---|
Type | Description |
string | The formatted project_location_data_source resource. |
static::projectLocationTransferConfigName
Formats a string containing the fully-qualified path to represent a project_location_transfer_config resource.
Parameters | |
---|---|
Name | Description |
project |
string
|
location |
string
|
transferConfig |
string
|
Returns | |
---|---|
Type | Description |
string | The formatted project_location_transfer_config resource. |
static::projectLocationTransferConfigRunName
Formats a string containing the fully-qualified path to represent a project_location_transfer_config_run resource.
Parameters | |
---|---|
Name | Description |
project |
string
|
location |
string
|
transferConfig |
string
|
run |
string
|
Returns | |
---|---|
Type | Description |
string | The formatted project_location_transfer_config_run resource. |
static::projectTransferConfigName
Formats a string containing the fully-qualified path to represent a project_transfer_config resource.
Parameters | |
---|---|
Name | Description |
project |
string
|
transferConfig |
string
|
Returns | |
---|---|
Type | Description |
string | The formatted project_transfer_config resource. |
static::projectTransferConfigRunName
Formats a string containing the fully-qualified path to represent a project_transfer_config_run resource.
Parameters | |
---|---|
Name | Description |
project |
string
|
transferConfig |
string
|
run |
string
|
Returns | |
---|---|
Type | Description |
string | The formatted project_transfer_config_run resource. |
static::runName
Formats a string containing the fully-qualified path to represent a run resource.
Parameters | |
---|---|
Name | Description |
project |
string
|
transferConfig |
string
|
run |
string
|
Returns | |
---|---|
Type | Description |
string | The formatted run resource. |
static::transferConfigName
Formats a string containing the fully-qualified path to represent a transfer_config resource.
Parameters | |
---|---|
Name | Description |
project |
string
|
transferConfig |
string
|
Returns | |
---|---|
Type | Description |
string | The formatted transfer_config resource. |
static::parseName
Parses a formatted name string and returns an associative array of the components in the name.
The following name formats are supported: Template: Pattern
- dataSource: projects/{project}/dataSources/{data_source}
- location: projects/{project}/locations/{location}
- project: projects/{project}
- projectDataSource: projects/{project}/dataSources/{data_source}
- projectLocationDataSource: projects/{project}/locations/{location}/dataSources/{data_source}
- projectLocationTransferConfig: projects/{project}/locations/{location}/transferConfigs/{transfer_config}
- projectLocationTransferConfigRun: projects/{project}/locations/{location}/transferConfigs/{transfer_config}/runs/{run}
- projectTransferConfig: projects/{project}/transferConfigs/{transfer_config}
- projectTransferConfigRun: projects/{project}/transferConfigs/{transfer_config}/runs/{run}
- run: projects/{project}/transferConfigs/{transfer_config}/runs/{run}
- transferConfig: projects/{project}/transferConfigs/{transfer_config}
The optional $template argument can be supplied to specify a particular pattern, and must match one of the templates listed above. If no $template argument is provided, or if the $template argument does not match one of the templates listed, then parseName will check each of the supported templates, and return the first match.
Parameters | |
---|---|
Name | Description |
formattedName |
string
The formatted name string |
template |
string
Optional name of template to match |
Returns | |
---|---|
Type | Description |
array | An associative array from name component IDs to component values. |
Constants
SERVICE_NAME
Value: 'google.cloud.bigquery.datatransfer.v1.DataTransferService'
The name of the service.
SERVICE_ADDRESS
Value: 'bigquerydatatransfer.googleapis.com'
The default address of the service.
DEFAULT_SERVICE_PORT
Value: 443
The default port of the service.
CODEGEN_NAME
Value: 'gapic'
The name of the code generator, to be included in the agent header.