Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Support new location based data sources. #2285

Merged
merged 1 commit into from
Aug 29, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,9 @@ class DataTransferServiceGapicClient
'https://www.googleapis.com/auth/cloud-platform',
];
private static $locationNameTemplate;
private static $locationDataSourceNameTemplate;
private static $locationRunNameTemplate;
private static $locationTransferConfigNameTemplate;
private static $projectNameTemplate;
private static $projectDataSourceNameTemplate;
private static $projectRunNameTemplate;
Expand Down Expand Up @@ -156,6 +159,33 @@ private static function getLocationNameTemplate()
return self::$locationNameTemplate;
}

private static function getLocationDataSourceNameTemplate()
{
if (null == self::$locationDataSourceNameTemplate) {
self::$locationDataSourceNameTemplate = new PathTemplate('projects/{project}/locations/{location}/dataSources/{data_source}');
}

return self::$locationDataSourceNameTemplate;
}

private static function getLocationRunNameTemplate()
{
if (null == self::$locationRunNameTemplate) {
self::$locationRunNameTemplate = new PathTemplate('projects/{project}/locations/{location}/transferConfigs/{transfer_config}/runs/{run}');
}

return self::$locationRunNameTemplate;
}

private static function getLocationTransferConfigNameTemplate()
{
if (null == self::$locationTransferConfigNameTemplate) {
self::$locationTransferConfigNameTemplate = new PathTemplate('projects/{project}/locations/{location}/transferConfigs/{transfer_config}');
}

return self::$locationTransferConfigNameTemplate;
}

private static function getProjectNameTemplate()
{
if (null == self::$projectNameTemplate) {
Expand Down Expand Up @@ -197,6 +227,9 @@ private static function getPathTemplateMap()
if (null == self::$pathTemplateMap) {
self::$pathTemplateMap = [
'location' => self::getLocationNameTemplate(),
'locationDataSource' => self::getLocationDataSourceNameTemplate(),
'locationRun' => self::getLocationRunNameTemplate(),
'locationTransferConfig' => self::getLocationTransferConfigNameTemplate(),
'project' => self::getProjectNameTemplate(),
'projectDataSource' => self::getProjectDataSourceNameTemplate(),
'projectRun' => self::getProjectRunNameTemplate(),
Expand Down Expand Up @@ -225,6 +258,68 @@ public static function locationName($project, $location)
]);
}

/**
* Formats a string containing the fully-qualified path to represent
* a location_data_source resource.
*
* @param string $project
* @param string $location
* @param string $dataSource
*
* @return string The formatted location_data_source resource.
* @experimental
*/
public static function locationDataSourceName($project, $location, $dataSource)
{
return self::getLocationDataSourceNameTemplate()->render([
'project' => $project,
'location' => $location,
'data_source' => $dataSource,
]);
}

/**
* Formats a string containing the fully-qualified path to represent
* a location_run resource.
*
* @param string $project
* @param string $location
* @param string $transferConfig
* @param string $run
*
* @return string The formatted location_run resource.
* @experimental
*/
public static function locationRunName($project, $location, $transferConfig, $run)
{
return self::getLocationRunNameTemplate()->render([
'project' => $project,
'location' => $location,
'transfer_config' => $transferConfig,
'run' => $run,
]);
}

/**
* Formats a string containing the fully-qualified path to represent
* a location_transfer_config resource.
*
* @param string $project
* @param string $location
* @param string $transferConfig
*
* @return string The formatted location_transfer_config resource.
* @experimental
*/
public static function locationTransferConfigName($project, $location, $transferConfig)
{
return self::getLocationTransferConfigNameTemplate()->render([
'project' => $project,
'location' => $location,
'transfer_config' => $transferConfig,
]);
}

/**
* Formats a string containing the fully-qualified path to represent
* a project resource.
Expand Down Expand Up @@ -302,6 +397,9 @@ public static function projectTransferConfigName($project, $transferConfig)
* The following name formats are supported:
* Template: Pattern
* - location: projects/{project}/locations/{location}
* - locationDataSource: projects/{project}/locations/{location}/dataSources/{data_source}
* - locationRun: projects/{project}/locations/{location}/transferConfigs/{transfer_config}/runs/{run}
* - locationTransferConfig: projects/{project}/locations/{location}/transferConfigs/{transfer_config}
* - project: projects/{project}
* - projectDataSource: projects/{project}/dataSources/{data_source}
* - projectRun: projects/{project}/transferConfigs/{transfer_config}/runs/{run}
Expand Down
10 changes: 5 additions & 5 deletions BigQueryDataTransfer/synth.metadata
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
{
"updateTime": "2019-08-07T17:58:08.703518Z",
"updateTime": "2019-08-29T18:33:44.271324Z",
"sources": [
{
"generator": {
"name": "artman",
"version": "0.29.1",
"dockerImage": "googleapis/artman@sha256:b2a73f4dda03ef8fcaa973e3ba26d0cf34091f6c22c70add663af325931aef4d"
"version": "0.35.1",
"dockerImage": "googleapis/artman@sha256:b11c7ea0d0831c54016fb50f4b796d24d1971439b30fbc32a369ba1ac887c384"
}
},
{
"git": {
"name": "googleapis",
"remote": "https://github.com/googleapis/googleapis.git",
"sha": "3a1b46a6668194a527e532a2c355b404c79b0e6a",
"internalRef": "262167956"
"sha": "e121a35579e73377f998c11bcc09ba0486736404",
"internalRef": "265953539"
}
}
],
Expand Down