Skip to content

Commit ffe5e89

Browse files
gcf-owl-bot[bot]chingor13bcoe
authored
docs(samples): add auto-generated samples for Node with api short name 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 <[email protected]> Co-authored-by: bcoe <[email protected]>
1 parent ec62e9b commit ffe5e89

16 files changed

+958
-9
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
// Copyright 2021 Google LLC
2+
//
3+
// Licensed under the Apache License, Version 2.0 (the "License");
4+
// you may not use this file except in compliance with the License.
5+
// You may obtain a copy of the License at
6+
//
7+
// http://www.apache.org/licenses/LICENSE-2.0
8+
//
9+
// Unless required by applicable law or agreed to in writing, software
10+
// distributed under the License is distributed on an "AS IS" BASIS,
11+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
// See the License for the specific language governing permissions and
13+
// limitations under the License.
14+
15+
'use strict';
16+
17+
function main(name) {
18+
// [START bigquerydatatransfer_v1_generated_DataTransferService_CheckValidCreds_async]
19+
/**
20+
* TODO(developer): Uncomment these variables before running the sample.
21+
*/
22+
/**
23+
* Required. The data source in the form:
24+
* `projects/{project_id}/dataSources/{data_source_id}` or
25+
* `projects/{project_id}/locations/{location_id}/dataSources/{data_source_id}`.
26+
*/
27+
// const name = 'abc123'
28+
29+
// Imports the Datatransfer library
30+
const {DataTransferServiceClient} =
31+
require('@google-cloud/bigquery-data-transfer').v1;
32+
33+
// Instantiates a client
34+
const datatransferClient = new DataTransferServiceClient();
35+
36+
async function checkValidCreds() {
37+
// Construct request
38+
const request = {
39+
name,
40+
};
41+
42+
// Run request
43+
const response = await datatransferClient.checkValidCreds(request);
44+
console.log(response);
45+
}
46+
47+
checkValidCreds();
48+
// [END bigquerydatatransfer_v1_generated_DataTransferService_CheckValidCreds_async]
49+
}
50+
51+
process.on('unhandledRejection', err => {
52+
console.error(err.message);
53+
process.exitCode = 1;
54+
});
55+
main(...process.argv.slice(2));
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,95 @@
1+
// Copyright 2021 Google LLC
2+
//
3+
// Licensed under the Apache License, Version 2.0 (the "License");
4+
// you may not use this file except in compliance with the License.
5+
// You may obtain a copy of the License at
6+
//
7+
// http://www.apache.org/licenses/LICENSE-2.0
8+
//
9+
// Unless required by applicable law or agreed to in writing, software
10+
// distributed under the License is distributed on an "AS IS" BASIS,
11+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
// See the License for the specific language governing permissions and
13+
// limitations under the License.
14+
15+
'use strict';
16+
17+
function main(parent, transferConfig) {
18+
// [START bigquerydatatransfer_v1_generated_DataTransferService_CreateTransferConfig_async]
19+
/**
20+
* TODO(developer): Uncomment these variables before running the sample.
21+
*/
22+
/**
23+
* Required. The BigQuery project id where the transfer configuration should be created.
24+
* Must be in the format projects/{project_id}/locations/{location_id} or
25+
* projects/{project_id}. If specified location and location of the
26+
* destination bigquery dataset do not match - the request will fail.
27+
*/
28+
// const parent = 'abc123'
29+
/**
30+
* Required. Data transfer configuration to create.
31+
*/
32+
// const transferConfig = ''
33+
/**
34+
* Optional OAuth2 authorization code to use with this transfer configuration.
35+
* This is required if new credentials are needed, as indicated by
36+
* `CheckValidCreds`.
37+
* In order to obtain authorization_code, please make a
38+
* request to
39+
* https://www.gstatic.com/bigquerydatatransfer/oauthz/auth?client_id=<datatransferapiclientid>&scope=<data_source_scopes>&redirect_uri=<redirect_uri>
40+
* * client_id should be OAuth client_id of BigQuery DTS API for the given
41+
* data source returned by ListDataSources method.
42+
* * data_source_scopes are the scopes returned by ListDataSources method.
43+
* * redirect_uri is an optional parameter. If not specified, then
44+
* authorization code is posted to the opener of authorization flow window.
45+
* Otherwise it will be sent to the redirect uri. A special value of
46+
* urn:ietf:wg:oauth:2.0:oob means that authorization code should be
47+
* returned in the title bar of the browser, with the page text prompting
48+
* the user to copy the code and paste it in the application.
49+
*/
50+
// const authorizationCode = 'abc123'
51+
/**
52+
* Optional version info. If users want to find a very recent access token,
53+
* that is, immediately after approving access, users have to set the
54+
* version_info claim in the token request. To obtain the version_info, users
55+
* must use the "none+gsession" response type. which be return a
56+
* version_info back in the authorization response which be be put in a JWT
57+
* claim in the token request.
58+
*/
59+
// const versionInfo = 'abc123'
60+
/**
61+
* Optional service account name. If this field is set, transfer config will
62+
* be created with this service account credentials. It requires that
63+
* requesting user calling this API has permissions to act as this service
64+
* account.
65+
*/
66+
// const serviceAccountName = 'abc123'
67+
68+
// Imports the Datatransfer library
69+
const {DataTransferServiceClient} =
70+
require('@google-cloud/bigquery-data-transfer').v1;
71+
72+
// Instantiates a client
73+
const datatransferClient = new DataTransferServiceClient();
74+
75+
async function createTransferConfig() {
76+
// Construct request
77+
const request = {
78+
parent,
79+
transferConfig,
80+
};
81+
82+
// Run request
83+
const response = await datatransferClient.createTransferConfig(request);
84+
console.log(response);
85+
}
86+
87+
createTransferConfig();
88+
// [END bigquerydatatransfer_v1_generated_DataTransferService_CreateTransferConfig_async]
89+
}
90+
91+
process.on('unhandledRejection', err => {
92+
console.error(err.message);
93+
process.exitCode = 1;
94+
});
95+
main(...process.argv.slice(2));
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
// Copyright 2021 Google LLC
2+
//
3+
// Licensed under the Apache License, Version 2.0 (the "License");
4+
// you may not use this file except in compliance with the License.
5+
// You may obtain a copy of the License at
6+
//
7+
// http://www.apache.org/licenses/LICENSE-2.0
8+
//
9+
// Unless required by applicable law or agreed to in writing, software
10+
// distributed under the License is distributed on an "AS IS" BASIS,
11+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
// See the License for the specific language governing permissions and
13+
// limitations under the License.
14+
15+
'use strict';
16+
17+
function main(name) {
18+
// [START bigquerydatatransfer_v1_generated_DataTransferService_DeleteTransferConfig_async]
19+
/**
20+
* TODO(developer): Uncomment these variables before running the sample.
21+
*/
22+
/**
23+
* Required. The field will contain name of the resource requested, for example:
24+
* `projects/{project_id}/transferConfigs/{config_id}` or
25+
* `projects/{project_id}/locations/{location_id}/transferConfigs/{config_id}`
26+
*/
27+
// const name = 'abc123'
28+
29+
// Imports the Datatransfer library
30+
const {DataTransferServiceClient} =
31+
require('@google-cloud/bigquery-data-transfer').v1;
32+
33+
// Instantiates a client
34+
const datatransferClient = new DataTransferServiceClient();
35+
36+
async function deleteTransferConfig() {
37+
// Construct request
38+
const request = {
39+
name,
40+
};
41+
42+
// Run request
43+
const response = await datatransferClient.deleteTransferConfig(request);
44+
console.log(response);
45+
}
46+
47+
deleteTransferConfig();
48+
// [END bigquerydatatransfer_v1_generated_DataTransferService_DeleteTransferConfig_async]
49+
}
50+
51+
process.on('unhandledRejection', err => {
52+
console.error(err.message);
53+
process.exitCode = 1;
54+
});
55+
main(...process.argv.slice(2));
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
// Copyright 2021 Google LLC
2+
//
3+
// Licensed under the Apache License, Version 2.0 (the "License");
4+
// you may not use this file except in compliance with the License.
5+
// You may obtain a copy of the License at
6+
//
7+
// http://www.apache.org/licenses/LICENSE-2.0
8+
//
9+
// Unless required by applicable law or agreed to in writing, software
10+
// distributed under the License is distributed on an "AS IS" BASIS,
11+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
// See the License for the specific language governing permissions and
13+
// limitations under the License.
14+
15+
'use strict';
16+
17+
function main(name) {
18+
// [START bigquerydatatransfer_v1_generated_DataTransferService_DeleteTransferRun_async]
19+
/**
20+
* TODO(developer): Uncomment these variables before running the sample.
21+
*/
22+
/**
23+
* Required. The field will contain name of the resource requested, for example:
24+
* `projects/{project_id}/transferConfigs/{config_id}/runs/{run_id}` or
25+
* `projects/{project_id}/locations/{location_id}/transferConfigs/{config_id}/runs/{run_id}`
26+
*/
27+
// const name = 'abc123'
28+
29+
// Imports the Datatransfer library
30+
const {DataTransferServiceClient} =
31+
require('@google-cloud/bigquery-data-transfer').v1;
32+
33+
// Instantiates a client
34+
const datatransferClient = new DataTransferServiceClient();
35+
36+
async function deleteTransferRun() {
37+
// Construct request
38+
const request = {
39+
name,
40+
};
41+
42+
// Run request
43+
const response = await datatransferClient.deleteTransferRun(request);
44+
console.log(response);
45+
}
46+
47+
deleteTransferRun();
48+
// [END bigquerydatatransfer_v1_generated_DataTransferService_DeleteTransferRun_async]
49+
}
50+
51+
process.on('unhandledRejection', err => {
52+
console.error(err.message);
53+
process.exitCode = 1;
54+
});
55+
main(...process.argv.slice(2));
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
// Copyright 2021 Google LLC
2+
//
3+
// Licensed under the Apache License, Version 2.0 (the "License");
4+
// you may not use this file except in compliance with the License.
5+
// You may obtain a copy of the License at
6+
//
7+
// http://www.apache.org/licenses/LICENSE-2.0
8+
//
9+
// Unless required by applicable law or agreed to in writing, software
10+
// distributed under the License is distributed on an "AS IS" BASIS,
11+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
// See the License for the specific language governing permissions and
13+
// limitations under the License.
14+
15+
'use strict';
16+
17+
function main(name) {
18+
// [START bigquerydatatransfer_v1_generated_DataTransferService_GetDataSource_async]
19+
/**
20+
* TODO(developer): Uncomment these variables before running the sample.
21+
*/
22+
/**
23+
* Required. The field will contain name of the resource requested, for example:
24+
* `projects/{project_id}/dataSources/{data_source_id}` or
25+
* `projects/{project_id}/locations/{location_id}/dataSources/{data_source_id}`
26+
*/
27+
// const name = 'abc123'
28+
29+
// Imports the Datatransfer library
30+
const {DataTransferServiceClient} =
31+
require('@google-cloud/bigquery-data-transfer').v1;
32+
33+
// Instantiates a client
34+
const datatransferClient = new DataTransferServiceClient();
35+
36+
async function getDataSource() {
37+
// Construct request
38+
const request = {
39+
name,
40+
};
41+
42+
// Run request
43+
const response = await datatransferClient.getDataSource(request);
44+
console.log(response);
45+
}
46+
47+
getDataSource();
48+
// [END bigquerydatatransfer_v1_generated_DataTransferService_GetDataSource_async]
49+
}
50+
51+
process.on('unhandledRejection', err => {
52+
console.error(err.message);
53+
process.exitCode = 1;
54+
});
55+
main(...process.argv.slice(2));
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
// Copyright 2021 Google LLC
2+
//
3+
// Licensed under the Apache License, Version 2.0 (the "License");
4+
// you may not use this file except in compliance with the License.
5+
// You may obtain a copy of the License at
6+
//
7+
// http://www.apache.org/licenses/LICENSE-2.0
8+
//
9+
// Unless required by applicable law or agreed to in writing, software
10+
// distributed under the License is distributed on an "AS IS" BASIS,
11+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
// See the License for the specific language governing permissions and
13+
// limitations under the License.
14+
15+
'use strict';
16+
17+
function main(name) {
18+
// [START bigquerydatatransfer_v1_generated_DataTransferService_GetTransferConfig_async]
19+
/**
20+
* TODO(developer): Uncomment these variables before running the sample.
21+
*/
22+
/**
23+
* Required. The field will contain name of the resource requested, for example:
24+
* `projects/{project_id}/transferConfigs/{config_id}` or
25+
* `projects/{project_id}/locations/{location_id}/transferConfigs/{config_id}`
26+
*/
27+
// const name = 'abc123'
28+
29+
// Imports the Datatransfer library
30+
const {DataTransferServiceClient} =
31+
require('@google-cloud/bigquery-data-transfer').v1;
32+
33+
// Instantiates a client
34+
const datatransferClient = new DataTransferServiceClient();
35+
36+
async function getTransferConfig() {
37+
// Construct request
38+
const request = {
39+
name,
40+
};
41+
42+
// Run request
43+
const response = await datatransferClient.getTransferConfig(request);
44+
console.log(response);
45+
}
46+
47+
getTransferConfig();
48+
// [END bigquerydatatransfer_v1_generated_DataTransferService_GetTransferConfig_async]
49+
}
50+
51+
process.on('unhandledRejection', err => {
52+
console.error(err.message);
53+
process.exitCode = 1;
54+
});
55+
main(...process.argv.slice(2));

0 commit comments

Comments
 (0)