Skip to content

Commit d4ee9a4

Browse files
docs(samples): add auto-generated samples for Node with api short name in region tag (#133)
- [ ] Regenerate this pull request now. PiperOrigin-RevId: 399287285 Source-Link: googleapis/googleapis@1575986 Source-Link: googleapis/googleapis-gen@b27fff6 Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiYjI3ZmZmNjIzYTVkOGQ1ODZiNzAzYjVlNDkxOTg1NmFiZTdjMmViMyJ9
1 parent 141ae23 commit d4ee9a4

9 files changed

+487
-2
lines changed
Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
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, connection) {
18+
// [START bigqueryconnection_v1_generated_ConnectionService_CreateConnection_async]
19+
/**
20+
* TODO(developer): Uncomment these variables before running the sample.
21+
*/
22+
/**
23+
* Required. Parent resource name.
24+
* Must be in the format `projects/{project_id}/locations/{location_id}`
25+
*/
26+
// const parent = 'abc123'
27+
/**
28+
* Optional. Connection id that should be assigned to the created connection.
29+
*/
30+
// const connectionId = 'abc123'
31+
/**
32+
* Required. Connection to create.
33+
*/
34+
// const connection = ''
35+
36+
// Imports the Connection library
37+
const {ConnectionServiceClient} =
38+
require('@google-cloud/bigquery-connection').v1;
39+
40+
// Instantiates a client
41+
const connectionClient = new ConnectionServiceClient();
42+
43+
async function createConnection() {
44+
// Construct request
45+
const request = {
46+
parent,
47+
connection,
48+
};
49+
50+
// Run request
51+
const response = await connectionClient.createConnection(request);
52+
console.log(response);
53+
}
54+
55+
createConnection();
56+
// [END bigqueryconnection_v1_generated_ConnectionService_CreateConnection_async]
57+
}
58+
59+
process.on('unhandledRejection', err => {
60+
console.error(err.message);
61+
process.exitCode = 1;
62+
});
63+
main(...process.argv.slice(2));
Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
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 bigqueryconnection_v1_generated_ConnectionService_DeleteConnection_async]
19+
/**
20+
* TODO(developer): Uncomment these variables before running the sample.
21+
*/
22+
/**
23+
* Required. Name of the deleted connection, for example:
24+
* `projects/{project_id}/locations/{location_id}/connections/{connection_id}`
25+
*/
26+
// const name = 'abc123'
27+
28+
// Imports the Connection library
29+
const {ConnectionServiceClient} =
30+
require('@google-cloud/bigquery-connection').v1;
31+
32+
// Instantiates a client
33+
const connectionClient = new ConnectionServiceClient();
34+
35+
async function deleteConnection() {
36+
// Construct request
37+
const request = {
38+
name,
39+
};
40+
41+
// Run request
42+
const response = await connectionClient.deleteConnection(request);
43+
console.log(response);
44+
}
45+
46+
deleteConnection();
47+
// [END bigqueryconnection_v1_generated_ConnectionService_DeleteConnection_async]
48+
}
49+
50+
process.on('unhandledRejection', err => {
51+
console.error(err.message);
52+
process.exitCode = 1;
53+
});
54+
main(...process.argv.slice(2));
Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
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 bigqueryconnection_v1_generated_ConnectionService_GetConnection_async]
19+
/**
20+
* TODO(developer): Uncomment these variables before running the sample.
21+
*/
22+
/**
23+
* Required. Name of the requested connection, for example:
24+
* `projects/{project_id}/locations/{location_id}/connections/{connection_id}`
25+
*/
26+
// const name = 'abc123'
27+
28+
// Imports the Connection library
29+
const {ConnectionServiceClient} =
30+
require('@google-cloud/bigquery-connection').v1;
31+
32+
// Instantiates a client
33+
const connectionClient = new ConnectionServiceClient();
34+
35+
async function getConnection() {
36+
// Construct request
37+
const request = {
38+
name,
39+
};
40+
41+
// Run request
42+
const response = await connectionClient.getConnection(request);
43+
console.log(response);
44+
}
45+
46+
getConnection();
47+
// [END bigqueryconnection_v1_generated_ConnectionService_GetConnection_async]
48+
}
49+
50+
process.on('unhandledRejection', err => {
51+
console.error(err.message);
52+
process.exitCode = 1;
53+
});
54+
main(...process.argv.slice(2));
Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
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(resource) {
18+
// [START bigqueryconnection_v1_generated_ConnectionService_GetIamPolicy_async]
19+
/**
20+
* TODO(developer): Uncomment these variables before running the sample.
21+
*/
22+
/**
23+
* REQUIRED: The resource for which the policy is being requested.
24+
* See the operation documentation for the appropriate value for this field.
25+
*/
26+
// const resource = 'abc123'
27+
/**
28+
* OPTIONAL: A `GetPolicyOptions` object for specifying options to
29+
* `GetIamPolicy`. This field is only used by Cloud IAM.
30+
*/
31+
// const options = ''
32+
33+
// Imports the Connection library
34+
const {ConnectionServiceClient} =
35+
require('@google-cloud/bigquery-connection').v1;
36+
37+
// Instantiates a client
38+
const connectionClient = new ConnectionServiceClient();
39+
40+
async function getIamPolicy() {
41+
// Construct request
42+
const request = {
43+
resource,
44+
};
45+
46+
// Run request
47+
const response = await connectionClient.getIamPolicy(request);
48+
console.log(response);
49+
}
50+
51+
getIamPolicy();
52+
// [END bigqueryconnection_v1_generated_ConnectionService_GetIamPolicy_async]
53+
}
54+
55+
process.on('unhandledRejection', err => {
56+
console.error(err.message);
57+
process.exitCode = 1;
58+
});
59+
main(...process.argv.slice(2));
Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
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, pageSize) {
18+
// [START bigqueryconnection_v1_generated_ConnectionService_ListConnections_async]
19+
/**
20+
* TODO(developer): Uncomment these variables before running the sample.
21+
*/
22+
/**
23+
* Required. Parent resource name.
24+
* Must be in the form: `projects/{project_id}/locations/{location_id}`
25+
*/
26+
// const parent = 'abc123'
27+
/**
28+
* Required. Page size.
29+
*/
30+
// const pageSize = 1234
31+
/**
32+
* Page token.
33+
*/
34+
// const pageToken = 'abc123'
35+
36+
// Imports the Connection library
37+
const {ConnectionServiceClient} =
38+
require('@google-cloud/bigquery-connection').v1;
39+
40+
// Instantiates a client
41+
const connectionClient = new ConnectionServiceClient();
42+
43+
async function listConnections() {
44+
// Construct request
45+
const request = {
46+
parent,
47+
pageSize,
48+
};
49+
50+
// Run request
51+
const iterable = await connectionClient.listConnectionsAsync(request);
52+
for await (const response of iterable) {
53+
console.log(response);
54+
}
55+
}
56+
57+
listConnections();
58+
// [END bigqueryconnection_v1_generated_ConnectionService_ListConnections_async]
59+
}
60+
61+
process.on('unhandledRejection', err => {
62+
console.error(err.message);
63+
process.exitCode = 1;
64+
});
65+
main(...process.argv.slice(2));
Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
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(resource, policy) {
18+
// [START bigqueryconnection_v1_generated_ConnectionService_SetIamPolicy_async]
19+
/**
20+
* TODO(developer): Uncomment these variables before running the sample.
21+
*/
22+
/**
23+
* REQUIRED: The resource for which the policy is being specified.
24+
* See the operation documentation for the appropriate value for this field.
25+
*/
26+
// const resource = 'abc123'
27+
/**
28+
* REQUIRED: The complete policy to be applied to the `resource`. The size of
29+
* the policy is limited to a few 10s of KB. An empty policy is a
30+
* valid policy but certain Cloud Platform services (such as Projects)
31+
* might reject them.
32+
*/
33+
// const policy = ''
34+
35+
// Imports the Connection library
36+
const {ConnectionServiceClient} =
37+
require('@google-cloud/bigquery-connection').v1;
38+
39+
// Instantiates a client
40+
const connectionClient = new ConnectionServiceClient();
41+
42+
async function setIamPolicy() {
43+
// Construct request
44+
const request = {
45+
resource,
46+
policy,
47+
};
48+
49+
// Run request
50+
const response = await connectionClient.setIamPolicy(request);
51+
console.log(response);
52+
}
53+
54+
setIamPolicy();
55+
// [END bigqueryconnection_v1_generated_ConnectionService_SetIamPolicy_async]
56+
}
57+
58+
process.on('unhandledRejection', err => {
59+
console.error(err.message);
60+
process.exitCode = 1;
61+
});
62+
main(...process.argv.slice(2));

0 commit comments

Comments
 (0)