Skip to content

Commit

Permalink
docs(samples): add auto-generated samples for Node with api short nam…
Browse files Browse the repository at this point in the history
…e 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
  • Loading branch information
gcf-owl-bot[bot] authored Oct 5, 2021
1 parent 141ae23 commit d4ee9a4
Show file tree
Hide file tree
Showing 9 changed files with 487 additions and 2 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
// 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, connection) {
// [START bigqueryconnection_v1_generated_ConnectionService_CreateConnection_async]
/**
* TODO(developer): Uncomment these variables before running the sample.
*/
/**
* Required. Parent resource name.
* Must be in the format `projects/{project_id}/locations/{location_id}`
*/
// const parent = 'abc123'
/**
* Optional. Connection id that should be assigned to the created connection.
*/
// const connectionId = 'abc123'
/**
* Required. Connection to create.
*/
// const connection = ''

// Imports the Connection library
const {ConnectionServiceClient} =
require('@google-cloud/bigquery-connection').v1;

// Instantiates a client
const connectionClient = new ConnectionServiceClient();

async function createConnection() {
// Construct request
const request = {
parent,
connection,
};

// Run request
const response = await connectionClient.createConnection(request);
console.log(response);
}

createConnection();
// [END bigqueryconnection_v1_generated_ConnectionService_CreateConnection_async]
}

process.on('unhandledRejection', err => {
console.error(err.message);
process.exitCode = 1;
});
main(...process.argv.slice(2));
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
// 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 bigqueryconnection_v1_generated_ConnectionService_DeleteConnection_async]
/**
* TODO(developer): Uncomment these variables before running the sample.
*/
/**
* Required. Name of the deleted connection, for example:
* `projects/{project_id}/locations/{location_id}/connections/{connection_id}`
*/
// const name = 'abc123'

// Imports the Connection library
const {ConnectionServiceClient} =
require('@google-cloud/bigquery-connection').v1;

// Instantiates a client
const connectionClient = new ConnectionServiceClient();

async function deleteConnection() {
// Construct request
const request = {
name,
};

// Run request
const response = await connectionClient.deleteConnection(request);
console.log(response);
}

deleteConnection();
// [END bigqueryconnection_v1_generated_ConnectionService_DeleteConnection_async]
}

process.on('unhandledRejection', err => {
console.error(err.message);
process.exitCode = 1;
});
main(...process.argv.slice(2));
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
// 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 bigqueryconnection_v1_generated_ConnectionService_GetConnection_async]
/**
* TODO(developer): Uncomment these variables before running the sample.
*/
/**
* Required. Name of the requested connection, for example:
* `projects/{project_id}/locations/{location_id}/connections/{connection_id}`
*/
// const name = 'abc123'

// Imports the Connection library
const {ConnectionServiceClient} =
require('@google-cloud/bigquery-connection').v1;

// Instantiates a client
const connectionClient = new ConnectionServiceClient();

async function getConnection() {
// Construct request
const request = {
name,
};

// Run request
const response = await connectionClient.getConnection(request);
console.log(response);
}

getConnection();
// [END bigqueryconnection_v1_generated_ConnectionService_GetConnection_async]
}

process.on('unhandledRejection', err => {
console.error(err.message);
process.exitCode = 1;
});
main(...process.argv.slice(2));
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
// 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(resource) {
// [START bigqueryconnection_v1_generated_ConnectionService_GetIamPolicy_async]
/**
* TODO(developer): Uncomment these variables before running the sample.
*/
/**
* REQUIRED: The resource for which the policy is being requested.
* See the operation documentation for the appropriate value for this field.
*/
// const resource = 'abc123'
/**
* OPTIONAL: A `GetPolicyOptions` object for specifying options to
* `GetIamPolicy`. This field is only used by Cloud IAM.
*/
// const options = ''

// Imports the Connection library
const {ConnectionServiceClient} =
require('@google-cloud/bigquery-connection').v1;

// Instantiates a client
const connectionClient = new ConnectionServiceClient();

async function getIamPolicy() {
// Construct request
const request = {
resource,
};

// Run request
const response = await connectionClient.getIamPolicy(request);
console.log(response);
}

getIamPolicy();
// [END bigqueryconnection_v1_generated_ConnectionService_GetIamPolicy_async]
}

process.on('unhandledRejection', err => {
console.error(err.message);
process.exitCode = 1;
});
main(...process.argv.slice(2));
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
// 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, pageSize) {
// [START bigqueryconnection_v1_generated_ConnectionService_ListConnections_async]
/**
* TODO(developer): Uncomment these variables before running the sample.
*/
/**
* Required. Parent resource name.
* Must be in the form: `projects/{project_id}/locations/{location_id}`
*/
// const parent = 'abc123'
/**
* Required. Page size.
*/
// const pageSize = 1234
/**
* Page token.
*/
// const pageToken = 'abc123'

// Imports the Connection library
const {ConnectionServiceClient} =
require('@google-cloud/bigquery-connection').v1;

// Instantiates a client
const connectionClient = new ConnectionServiceClient();

async function listConnections() {
// Construct request
const request = {
parent,
pageSize,
};

// Run request
const iterable = await connectionClient.listConnectionsAsync(request);
for await (const response of iterable) {
console.log(response);
}
}

listConnections();
// [END bigqueryconnection_v1_generated_ConnectionService_ListConnections_async]
}

process.on('unhandledRejection', err => {
console.error(err.message);
process.exitCode = 1;
});
main(...process.argv.slice(2));
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
// 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(resource, policy) {
// [START bigqueryconnection_v1_generated_ConnectionService_SetIamPolicy_async]
/**
* TODO(developer): Uncomment these variables before running the sample.
*/
/**
* REQUIRED: The resource for which the policy is being specified.
* See the operation documentation for the appropriate value for this field.
*/
// const resource = 'abc123'
/**
* REQUIRED: The complete policy to be applied to the `resource`. The size of
* the policy is limited to a few 10s of KB. An empty policy is a
* valid policy but certain Cloud Platform services (such as Projects)
* might reject them.
*/
// const policy = ''

// Imports the Connection library
const {ConnectionServiceClient} =
require('@google-cloud/bigquery-connection').v1;

// Instantiates a client
const connectionClient = new ConnectionServiceClient();

async function setIamPolicy() {
// Construct request
const request = {
resource,
policy,
};

// Run request
const response = await connectionClient.setIamPolicy(request);
console.log(response);
}

setIamPolicy();
// [END bigqueryconnection_v1_generated_ConnectionService_SetIamPolicy_async]
}

process.on('unhandledRejection', err => {
console.error(err.message);
process.exitCode = 1;
});
main(...process.argv.slice(2));
Loading

0 comments on commit d4ee9a4

Please sign in to comment.