-
Notifications
You must be signed in to change notification settings - Fork 592
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
docs(samples): add auto-generated samples for Node with api short nam…
…e in region tag (#499) PiperOrigin-RevId: 399287285 Source-Link: googleapis/googleapis@1575986 Source-Link: googleapis/googleapis-gen@b27fff6 Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiYjI3ZmZmNjIzYTVkOGQ1ODZiNzAzYjVlNDkxOTg1NmFiZTdjMmViMyJ9 Co-authored-by: Owl Bot <gcf-owl-bot[bot]@users.noreply.github.com> Co-authored-by: Jeff Ching <chingor@google.com> Co-authored-by: bcoe <bencoe@google.com>
- Loading branch information
Showing
16 changed files
with
958 additions
and
9 deletions.
There are no files selected for viewing
55 changes: 55 additions & 0 deletions
55
...oud-bigquery-datatransfer/samples/generated/v1/data_transfer_service.check_valid_creds.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
// Copyright 2021 Google LLC | ||
// | ||
// Licensed under the Apache License, Version 2.0 (the "License"); | ||
// you may not use this file except in compliance with the License. | ||
// You may obtain a copy of the License at | ||
// | ||
// http://www.apache.org/licenses/LICENSE-2.0 | ||
// | ||
// Unless required by applicable law or agreed to in writing, software | ||
// distributed under the License is distributed on an "AS IS" BASIS, | ||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
// See the License for the specific language governing permissions and | ||
// limitations under the License. | ||
|
||
'use strict'; | ||
|
||
function main(name) { | ||
// [START bigquerydatatransfer_v1_generated_DataTransferService_CheckValidCreds_async] | ||
/** | ||
* TODO(developer): Uncomment these variables before running the sample. | ||
*/ | ||
/** | ||
* Required. The data source in the form: | ||
* `projects/{project_id}/dataSources/{data_source_id}` or | ||
* `projects/{project_id}/locations/{location_id}/dataSources/{data_source_id}`. | ||
*/ | ||
// const name = 'abc123' | ||
|
||
// Imports the Datatransfer library | ||
const {DataTransferServiceClient} = | ||
require('@google-cloud/bigquery-data-transfer').v1; | ||
|
||
// Instantiates a client | ||
const datatransferClient = new DataTransferServiceClient(); | ||
|
||
async function checkValidCreds() { | ||
// Construct request | ||
const request = { | ||
name, | ||
}; | ||
|
||
// Run request | ||
const response = await datatransferClient.checkValidCreds(request); | ||
console.log(response); | ||
} | ||
|
||
checkValidCreds(); | ||
// [END bigquerydatatransfer_v1_generated_DataTransferService_CheckValidCreds_async] | ||
} | ||
|
||
process.on('unhandledRejection', err => { | ||
console.error(err.message); | ||
process.exitCode = 1; | ||
}); | ||
main(...process.argv.slice(2)); |
95 changes: 95 additions & 0 deletions
95
...igquery-datatransfer/samples/generated/v1/data_transfer_service.create_transfer_config.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,95 @@ | ||
// Copyright 2021 Google LLC | ||
// | ||
// Licensed under the Apache License, Version 2.0 (the "License"); | ||
// you may not use this file except in compliance with the License. | ||
// You may obtain a copy of the License at | ||
// | ||
// http://www.apache.org/licenses/LICENSE-2.0 | ||
// | ||
// Unless required by applicable law or agreed to in writing, software | ||
// distributed under the License is distributed on an "AS IS" BASIS, | ||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
// See the License for the specific language governing permissions and | ||
// limitations under the License. | ||
|
||
'use strict'; | ||
|
||
function main(parent, transferConfig) { | ||
// [START bigquerydatatransfer_v1_generated_DataTransferService_CreateTransferConfig_async] | ||
/** | ||
* TODO(developer): Uncomment these variables before running the sample. | ||
*/ | ||
/** | ||
* 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. | ||
*/ | ||
// const parent = 'abc123' | ||
/** | ||
* Required. Data transfer configuration to create. | ||
*/ | ||
// const transferConfig = '' | ||
/** | ||
* 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=<datatransferapiclientid>&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. | ||
*/ | ||
// const authorizationCode = 'abc123' | ||
/** | ||
* 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. | ||
*/ | ||
// const versionInfo = 'abc123' | ||
/** | ||
* Optional service account name. If this field is set, transfer config will | ||
* be created with this service account credentials. It requires that | ||
* requesting user calling this API has permissions to act as this service | ||
* account. | ||
*/ | ||
// const serviceAccountName = 'abc123' | ||
|
||
// Imports the Datatransfer library | ||
const {DataTransferServiceClient} = | ||
require('@google-cloud/bigquery-data-transfer').v1; | ||
|
||
// Instantiates a client | ||
const datatransferClient = new DataTransferServiceClient(); | ||
|
||
async function createTransferConfig() { | ||
// Construct request | ||
const request = { | ||
parent, | ||
transferConfig, | ||
}; | ||
|
||
// Run request | ||
const response = await datatransferClient.createTransferConfig(request); | ||
console.log(response); | ||
} | ||
|
||
createTransferConfig(); | ||
// [END bigquerydatatransfer_v1_generated_DataTransferService_CreateTransferConfig_async] | ||
} | ||
|
||
process.on('unhandledRejection', err => { | ||
console.error(err.message); | ||
process.exitCode = 1; | ||
}); | ||
main(...process.argv.slice(2)); |
55 changes: 55 additions & 0 deletions
55
...igquery-datatransfer/samples/generated/v1/data_transfer_service.delete_transfer_config.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
// Copyright 2021 Google LLC | ||
// | ||
// Licensed under the Apache License, Version 2.0 (the "License"); | ||
// you may not use this file except in compliance with the License. | ||
// You may obtain a copy of the License at | ||
// | ||
// http://www.apache.org/licenses/LICENSE-2.0 | ||
// | ||
// Unless required by applicable law or agreed to in writing, software | ||
// distributed under the License is distributed on an "AS IS" BASIS, | ||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
// See the License for the specific language governing permissions and | ||
// limitations under the License. | ||
|
||
'use strict'; | ||
|
||
function main(name) { | ||
// [START bigquerydatatransfer_v1_generated_DataTransferService_DeleteTransferConfig_async] | ||
/** | ||
* TODO(developer): Uncomment these variables before running the sample. | ||
*/ | ||
/** | ||
* Required. 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}` | ||
*/ | ||
// const name = 'abc123' | ||
|
||
// Imports the Datatransfer library | ||
const {DataTransferServiceClient} = | ||
require('@google-cloud/bigquery-data-transfer').v1; | ||
|
||
// Instantiates a client | ||
const datatransferClient = new DataTransferServiceClient(); | ||
|
||
async function deleteTransferConfig() { | ||
// Construct request | ||
const request = { | ||
name, | ||
}; | ||
|
||
// Run request | ||
const response = await datatransferClient.deleteTransferConfig(request); | ||
console.log(response); | ||
} | ||
|
||
deleteTransferConfig(); | ||
// [END bigquerydatatransfer_v1_generated_DataTransferService_DeleteTransferConfig_async] | ||
} | ||
|
||
process.on('unhandledRejection', err => { | ||
console.error(err.message); | ||
process.exitCode = 1; | ||
}); | ||
main(...process.argv.slice(2)); |
55 changes: 55 additions & 0 deletions
55
...d-bigquery-datatransfer/samples/generated/v1/data_transfer_service.delete_transfer_run.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
// Copyright 2021 Google LLC | ||
// | ||
// Licensed under the Apache License, Version 2.0 (the "License"); | ||
// you may not use this file except in compliance with the License. | ||
// You may obtain a copy of the License at | ||
// | ||
// http://www.apache.org/licenses/LICENSE-2.0 | ||
// | ||
// Unless required by applicable law or agreed to in writing, software | ||
// distributed under the License is distributed on an "AS IS" BASIS, | ||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
// See the License for the specific language governing permissions and | ||
// limitations under the License. | ||
|
||
'use strict'; | ||
|
||
function main(name) { | ||
// [START bigquerydatatransfer_v1_generated_DataTransferService_DeleteTransferRun_async] | ||
/** | ||
* TODO(developer): Uncomment these variables before running the sample. | ||
*/ | ||
/** | ||
* Required. 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}` | ||
*/ | ||
// const name = 'abc123' | ||
|
||
// Imports the Datatransfer library | ||
const {DataTransferServiceClient} = | ||
require('@google-cloud/bigquery-data-transfer').v1; | ||
|
||
// Instantiates a client | ||
const datatransferClient = new DataTransferServiceClient(); | ||
|
||
async function deleteTransferRun() { | ||
// Construct request | ||
const request = { | ||
name, | ||
}; | ||
|
||
// Run request | ||
const response = await datatransferClient.deleteTransferRun(request); | ||
console.log(response); | ||
} | ||
|
||
deleteTransferRun(); | ||
// [END bigquerydatatransfer_v1_generated_DataTransferService_DeleteTransferRun_async] | ||
} | ||
|
||
process.on('unhandledRejection', err => { | ||
console.error(err.message); | ||
process.exitCode = 1; | ||
}); | ||
main(...process.argv.slice(2)); |
55 changes: 55 additions & 0 deletions
55
...cloud-bigquery-datatransfer/samples/generated/v1/data_transfer_service.get_data_source.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
// Copyright 2021 Google LLC | ||
// | ||
// Licensed under the Apache License, Version 2.0 (the "License"); | ||
// you may not use this file except in compliance with the License. | ||
// You may obtain a copy of the License at | ||
// | ||
// http://www.apache.org/licenses/LICENSE-2.0 | ||
// | ||
// Unless required by applicable law or agreed to in writing, software | ||
// distributed under the License is distributed on an "AS IS" BASIS, | ||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
// See the License for the specific language governing permissions and | ||
// limitations under the License. | ||
|
||
'use strict'; | ||
|
||
function main(name) { | ||
// [START bigquerydatatransfer_v1_generated_DataTransferService_GetDataSource_async] | ||
/** | ||
* TODO(developer): Uncomment these variables before running the sample. | ||
*/ | ||
/** | ||
* Required. 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}` | ||
*/ | ||
// const name = 'abc123' | ||
|
||
// Imports the Datatransfer library | ||
const {DataTransferServiceClient} = | ||
require('@google-cloud/bigquery-data-transfer').v1; | ||
|
||
// Instantiates a client | ||
const datatransferClient = new DataTransferServiceClient(); | ||
|
||
async function getDataSource() { | ||
// Construct request | ||
const request = { | ||
name, | ||
}; | ||
|
||
// Run request | ||
const response = await datatransferClient.getDataSource(request); | ||
console.log(response); | ||
} | ||
|
||
getDataSource(); | ||
// [END bigquerydatatransfer_v1_generated_DataTransferService_GetDataSource_async] | ||
} | ||
|
||
process.on('unhandledRejection', err => { | ||
console.error(err.message); | ||
process.exitCode = 1; | ||
}); | ||
main(...process.argv.slice(2)); |
55 changes: 55 additions & 0 deletions
55
...d-bigquery-datatransfer/samples/generated/v1/data_transfer_service.get_transfer_config.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
// Copyright 2021 Google LLC | ||
// | ||
// Licensed under the Apache License, Version 2.0 (the "License"); | ||
// you may not use this file except in compliance with the License. | ||
// You may obtain a copy of the License at | ||
// | ||
// http://www.apache.org/licenses/LICENSE-2.0 | ||
// | ||
// Unless required by applicable law or agreed to in writing, software | ||
// distributed under the License is distributed on an "AS IS" BASIS, | ||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
// See the License for the specific language governing permissions and | ||
// limitations under the License. | ||
|
||
'use strict'; | ||
|
||
function main(name) { | ||
// [START bigquerydatatransfer_v1_generated_DataTransferService_GetTransferConfig_async] | ||
/** | ||
* TODO(developer): Uncomment these variables before running the sample. | ||
*/ | ||
/** | ||
* Required. 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}` | ||
*/ | ||
// const name = 'abc123' | ||
|
||
// Imports the Datatransfer library | ||
const {DataTransferServiceClient} = | ||
require('@google-cloud/bigquery-data-transfer').v1; | ||
|
||
// Instantiates a client | ||
const datatransferClient = new DataTransferServiceClient(); | ||
|
||
async function getTransferConfig() { | ||
// Construct request | ||
const request = { | ||
name, | ||
}; | ||
|
||
// Run request | ||
const response = await datatransferClient.getTransferConfig(request); | ||
console.log(response); | ||
} | ||
|
||
getTransferConfig(); | ||
// [END bigquerydatatransfer_v1_generated_DataTransferService_GetTransferConfig_async] | ||
} | ||
|
||
process.on('unhandledRejection', err => { | ||
console.error(err.message); | ||
process.exitCode = 1; | ||
}); | ||
main(...process.argv.slice(2)); |
Oops, something went wrong.