diff --git a/packages/google-cloud-bigquery-reservation/samples/generated/v1/reservation_service.create_assignment.js b/packages/google-cloud-bigquery-reservation/samples/generated/v1/reservation_service.create_assignment.js new file mode 100644 index 00000000000..c3eb6a86552 --- /dev/null +++ b/packages/google-cloud-bigquery-reservation/samples/generated/v1/reservation_service.create_assignment.js @@ -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) { + // [START bigqueryreservation_v1_generated_ReservationService_CreateAssignment_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The parent resource name of the assignment + * E.g. `projects/myproject/locations/US/reservations/team1-prod` + */ + // const parent = 'abc123' + /** + * Assignment resource to create. + */ + // const assignment = '' + /** + * The optional assignment ID. Assignment name will be generated automatically + * if this field is empty. + * This field must only contain lower case alphanumeric characters or dash. + * Max length is 64 characters. + */ + // const assignmentId = 'abc123' + + // Imports the Reservation library + const {ReservationServiceClient} = + require('@google-cloud/bigquery-reservation').v1; + + // Instantiates a client + const reservationClient = new ReservationServiceClient(); + + async function createAssignment() { + // Construct request + const request = { + parent, + }; + + // Run request + const response = await reservationClient.createAssignment(request); + console.log(response); + } + + createAssignment(); + // [END bigqueryreservation_v1_generated_ReservationService_CreateAssignment_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-cloud-bigquery-reservation/samples/generated/v1/reservation_service.create_capacity_commitment.js b/packages/google-cloud-bigquery-reservation/samples/generated/v1/reservation_service.create_capacity_commitment.js new file mode 100644 index 00000000000..32dd481bf5b --- /dev/null +++ b/packages/google-cloud-bigquery-reservation/samples/generated/v1/reservation_service.create_capacity_commitment.js @@ -0,0 +1,71 @@ +// 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) { + // [START bigqueryreservation_v1_generated_ReservationService_CreateCapacityCommitment_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. Resource name of the parent reservation. E.g., + * `projects/myproject/locations/US` + */ + // const parent = 'abc123' + /** + * Content of the capacity commitment to create. + */ + // const capacityCommitment = '' + /** + * If true, fail the request if another project in the organization has a + * capacity commitment. + */ + // const enforceSingleAdminProjectPerOrg = true + /** + * The optional capacity commitment ID. Capacity commitment name will be + * generated automatically if this field is empty. + * This field must only contain lower case alphanumeric characters or dash. + * Max length is 64 characters. + * NOTE: this ID won't be kept if the capacity commitment is split or merged. + */ + // const capacityCommitmentId = 'abc123' + + // Imports the Reservation library + const {ReservationServiceClient} = + require('@google-cloud/bigquery-reservation').v1; + + // Instantiates a client + const reservationClient = new ReservationServiceClient(); + + async function createCapacityCommitment() { + // Construct request + const request = { + parent, + }; + + // Run request + const response = await reservationClient.createCapacityCommitment(request); + console.log(response); + } + + createCapacityCommitment(); + // [END bigqueryreservation_v1_generated_ReservationService_CreateCapacityCommitment_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-cloud-bigquery-reservation/samples/generated/v1/reservation_service.create_reservation.js b/packages/google-cloud-bigquery-reservation/samples/generated/v1/reservation_service.create_reservation.js new file mode 100644 index 00000000000..f5c53986a6f --- /dev/null +++ b/packages/google-cloud-bigquery-reservation/samples/generated/v1/reservation_service.create_reservation.js @@ -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) { + // [START bigqueryreservation_v1_generated_ReservationService_CreateReservation_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. Project, location. E.g., + * `projects/myproject/locations/US` + */ + // const parent = 'abc123' + /** + * The reservation ID. This field must only contain lower case alphanumeric + * characters or dash. Max length is 64 characters. + */ + // const reservationId = 'abc123' + /** + * Definition of the new reservation to create. + */ + // const reservation = '' + + // Imports the Reservation library + const {ReservationServiceClient} = + require('@google-cloud/bigquery-reservation').v1; + + // Instantiates a client + const reservationClient = new ReservationServiceClient(); + + async function createReservation() { + // Construct request + const request = { + parent, + }; + + // Run request + const response = await reservationClient.createReservation(request); + console.log(response); + } + + createReservation(); + // [END bigqueryreservation_v1_generated_ReservationService_CreateReservation_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-cloud-bigquery-reservation/samples/generated/v1/reservation_service.delete_assignment.js b/packages/google-cloud-bigquery-reservation/samples/generated/v1/reservation_service.delete_assignment.js new file mode 100644 index 00000000000..75733986f36 --- /dev/null +++ b/packages/google-cloud-bigquery-reservation/samples/generated/v1/reservation_service.delete_assignment.js @@ -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 bigqueryreservation_v1_generated_ReservationService_DeleteAssignment_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. Name of the resource, e.g. + * `projects/myproject/locations/US/reservations/team1-prod/assignments/123` + */ + // const name = 'abc123' + + // Imports the Reservation library + const {ReservationServiceClient} = + require('@google-cloud/bigquery-reservation').v1; + + // Instantiates a client + const reservationClient = new ReservationServiceClient(); + + async function deleteAssignment() { + // Construct request + const request = { + name, + }; + + // Run request + const response = await reservationClient.deleteAssignment(request); + console.log(response); + } + + deleteAssignment(); + // [END bigqueryreservation_v1_generated_ReservationService_DeleteAssignment_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-cloud-bigquery-reservation/samples/generated/v1/reservation_service.delete_capacity_commitment.js b/packages/google-cloud-bigquery-reservation/samples/generated/v1/reservation_service.delete_capacity_commitment.js new file mode 100644 index 00000000000..5e87bc4b988 --- /dev/null +++ b/packages/google-cloud-bigquery-reservation/samples/generated/v1/reservation_service.delete_capacity_commitment.js @@ -0,0 +1,60 @@ +// 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 bigqueryreservation_v1_generated_ReservationService_DeleteCapacityCommitment_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. Resource name of the capacity commitment to delete. E.g., + * `projects/myproject/locations/US/capacityCommitments/123` + */ + // const name = 'abc123' + /** + * Can be used to force delete commitments even if assignments exist. Deleting + * commitments with assignments may cause queries to fail if they no longer + * have access to slots. + */ + // const force = true + + // Imports the Reservation library + const {ReservationServiceClient} = + require('@google-cloud/bigquery-reservation').v1; + + // Instantiates a client + const reservationClient = new ReservationServiceClient(); + + async function deleteCapacityCommitment() { + // Construct request + const request = { + name, + }; + + // Run request + const response = await reservationClient.deleteCapacityCommitment(request); + console.log(response); + } + + deleteCapacityCommitment(); + // [END bigqueryreservation_v1_generated_ReservationService_DeleteCapacityCommitment_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-cloud-bigquery-reservation/samples/generated/v1/reservation_service.delete_reservation.js b/packages/google-cloud-bigquery-reservation/samples/generated/v1/reservation_service.delete_reservation.js new file mode 100644 index 00000000000..04ceef5e546 --- /dev/null +++ b/packages/google-cloud-bigquery-reservation/samples/generated/v1/reservation_service.delete_reservation.js @@ -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 bigqueryreservation_v1_generated_ReservationService_DeleteReservation_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. Resource name of the reservation to retrieve. E.g., + * `projects/myproject/locations/US/reservations/team1-prod` + */ + // const name = 'abc123' + + // Imports the Reservation library + const {ReservationServiceClient} = + require('@google-cloud/bigquery-reservation').v1; + + // Instantiates a client + const reservationClient = new ReservationServiceClient(); + + async function deleteReservation() { + // Construct request + const request = { + name, + }; + + // Run request + const response = await reservationClient.deleteReservation(request); + console.log(response); + } + + deleteReservation(); + // [END bigqueryreservation_v1_generated_ReservationService_DeleteReservation_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-cloud-bigquery-reservation/samples/generated/v1/reservation_service.get_bi_reservation.js b/packages/google-cloud-bigquery-reservation/samples/generated/v1/reservation_service.get_bi_reservation.js new file mode 100644 index 00000000000..0b641aca56d --- /dev/null +++ b/packages/google-cloud-bigquery-reservation/samples/generated/v1/reservation_service.get_bi_reservation.js @@ -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 bigqueryreservation_v1_generated_ReservationService_GetBiReservation_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. Name of the requested reservation, for example: + * `projects/{project_id}/locations/{location_id}/biReservation` + */ + // const name = 'abc123' + + // Imports the Reservation library + const {ReservationServiceClient} = + require('@google-cloud/bigquery-reservation').v1; + + // Instantiates a client + const reservationClient = new ReservationServiceClient(); + + async function getBiReservation() { + // Construct request + const request = { + name, + }; + + // Run request + const response = await reservationClient.getBiReservation(request); + console.log(response); + } + + getBiReservation(); + // [END bigqueryreservation_v1_generated_ReservationService_GetBiReservation_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-cloud-bigquery-reservation/samples/generated/v1/reservation_service.get_capacity_commitment.js b/packages/google-cloud-bigquery-reservation/samples/generated/v1/reservation_service.get_capacity_commitment.js new file mode 100644 index 00000000000..f34f1124c77 --- /dev/null +++ b/packages/google-cloud-bigquery-reservation/samples/generated/v1/reservation_service.get_capacity_commitment.js @@ -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 bigqueryreservation_v1_generated_ReservationService_GetCapacityCommitment_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. Resource name of the capacity commitment to retrieve. E.g., + * `projects/myproject/locations/US/capacityCommitments/123` + */ + // const name = 'abc123' + + // Imports the Reservation library + const {ReservationServiceClient} = + require('@google-cloud/bigquery-reservation').v1; + + // Instantiates a client + const reservationClient = new ReservationServiceClient(); + + async function getCapacityCommitment() { + // Construct request + const request = { + name, + }; + + // Run request + const response = await reservationClient.getCapacityCommitment(request); + console.log(response); + } + + getCapacityCommitment(); + // [END bigqueryreservation_v1_generated_ReservationService_GetCapacityCommitment_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-cloud-bigquery-reservation/samples/generated/v1/reservation_service.get_reservation.js b/packages/google-cloud-bigquery-reservation/samples/generated/v1/reservation_service.get_reservation.js new file mode 100644 index 00000000000..e9e27f06cef --- /dev/null +++ b/packages/google-cloud-bigquery-reservation/samples/generated/v1/reservation_service.get_reservation.js @@ -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 bigqueryreservation_v1_generated_ReservationService_GetReservation_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. Resource name of the reservation to retrieve. E.g., + * `projects/myproject/locations/US/reservations/team1-prod` + */ + // const name = 'abc123' + + // Imports the Reservation library + const {ReservationServiceClient} = + require('@google-cloud/bigquery-reservation').v1; + + // Instantiates a client + const reservationClient = new ReservationServiceClient(); + + async function getReservation() { + // Construct request + const request = { + name, + }; + + // Run request + const response = await reservationClient.getReservation(request); + console.log(response); + } + + getReservation(); + // [END bigqueryreservation_v1_generated_ReservationService_GetReservation_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-cloud-bigquery-reservation/samples/generated/v1/reservation_service.list_assignments.js b/packages/google-cloud-bigquery-reservation/samples/generated/v1/reservation_service.list_assignments.js new file mode 100644 index 00000000000..02e24ed8d5e --- /dev/null +++ b/packages/google-cloud-bigquery-reservation/samples/generated/v1/reservation_service.list_assignments.js @@ -0,0 +1,66 @@ +// 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) { + // [START bigqueryreservation_v1_generated_ReservationService_ListAssignments_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The parent resource name e.g.: + * `projects/myproject/locations/US/reservations/team1-prod` + * Or: + * `projects/myproject/locations/US/reservations/-` + */ + // const parent = 'abc123' + /** + * The maximum number of items to return per page. + */ + // const pageSize = 1234 + /** + * The next_page_token value returned from a previous List request, if any. + */ + // const pageToken = 'abc123' + + // Imports the Reservation library + const {ReservationServiceClient} = + require('@google-cloud/bigquery-reservation').v1; + + // Instantiates a client + const reservationClient = new ReservationServiceClient(); + + async function listAssignments() { + // Construct request + const request = { + parent, + }; + + // Run request + const iterable = await reservationClient.listAssignmentsAsync(request); + for await (const response of iterable) { + console.log(response); + } + } + + listAssignments(); + // [END bigqueryreservation_v1_generated_ReservationService_ListAssignments_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-cloud-bigquery-reservation/samples/generated/v1/reservation_service.list_capacity_commitments.js b/packages/google-cloud-bigquery-reservation/samples/generated/v1/reservation_service.list_capacity_commitments.js new file mode 100644 index 00000000000..04a371b0861 --- /dev/null +++ b/packages/google-cloud-bigquery-reservation/samples/generated/v1/reservation_service.list_capacity_commitments.js @@ -0,0 +1,66 @@ +// 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) { + // [START bigqueryreservation_v1_generated_ReservationService_ListCapacityCommitments_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. Resource name of the parent reservation. E.g., + * `projects/myproject/locations/US` + */ + // const parent = 'abc123' + /** + * The maximum number of items to return. + */ + // const pageSize = 1234 + /** + * The next_page_token value returned from a previous List request, if any. + */ + // const pageToken = 'abc123' + + // Imports the Reservation library + const {ReservationServiceClient} = + require('@google-cloud/bigquery-reservation').v1; + + // Instantiates a client + const reservationClient = new ReservationServiceClient(); + + async function listCapacityCommitments() { + // Construct request + const request = { + parent, + }; + + // Run request + const iterable = await reservationClient.listCapacityCommitmentsAsync( + request + ); + for await (const response of iterable) { + console.log(response); + } + } + + listCapacityCommitments(); + // [END bigqueryreservation_v1_generated_ReservationService_ListCapacityCommitments_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-cloud-bigquery-reservation/samples/generated/v1/reservation_service.list_reservations.js b/packages/google-cloud-bigquery-reservation/samples/generated/v1/reservation_service.list_reservations.js new file mode 100644 index 00000000000..1b255ad6a03 --- /dev/null +++ b/packages/google-cloud-bigquery-reservation/samples/generated/v1/reservation_service.list_reservations.js @@ -0,0 +1,64 @@ +// 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) { + // [START bigqueryreservation_v1_generated_ReservationService_ListReservations_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The parent resource name containing project and location, e.g.: + * `projects/myproject/locations/US` + */ + // const parent = 'abc123' + /** + * The maximum number of items to return per page. + */ + // const pageSize = 1234 + /** + * The next_page_token value returned from a previous List request, if any. + */ + // const pageToken = 'abc123' + + // Imports the Reservation library + const {ReservationServiceClient} = + require('@google-cloud/bigquery-reservation').v1; + + // Instantiates a client + const reservationClient = new ReservationServiceClient(); + + async function listReservations() { + // Construct request + const request = { + parent, + }; + + // Run request + const iterable = await reservationClient.listReservationsAsync(request); + for await (const response of iterable) { + console.log(response); + } + } + + listReservations(); + // [END bigqueryreservation_v1_generated_ReservationService_ListReservations_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-cloud-bigquery-reservation/samples/generated/v1/reservation_service.merge_capacity_commitments.js b/packages/google-cloud-bigquery-reservation/samples/generated/v1/reservation_service.merge_capacity_commitments.js new file mode 100644 index 00000000000..9d15f02230c --- /dev/null +++ b/packages/google-cloud-bigquery-reservation/samples/generated/v1/reservation_service.merge_capacity_commitments.js @@ -0,0 +1,60 @@ +// 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() { + // [START bigqueryreservation_v1_generated_ReservationService_MergeCapacityCommitments_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Parent resource that identifies admin project and location e.g., + * `projects/myproject/locations/us` + */ + // const parent = 'abc123' + /** + * Ids of capacity commitments to merge. + * These capacity commitments must exist under admin project and location + * specified in the parent. + * ID is the last portion of capacity commitment name e.g., 'abc' for + * projects/myproject/locations/US/capacityCommitments/abc + */ + // const capacityCommitmentIds = 'abc123' + + // Imports the Reservation library + const {ReservationServiceClient} = + require('@google-cloud/bigquery-reservation').v1; + + // Instantiates a client + const reservationClient = new ReservationServiceClient(); + + async function mergeCapacityCommitments() { + // Construct request + const request = {}; + + // Run request + const response = await reservationClient.mergeCapacityCommitments(request); + console.log(response); + } + + mergeCapacityCommitments(); + // [END bigqueryreservation_v1_generated_ReservationService_MergeCapacityCommitments_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-cloud-bigquery-reservation/samples/generated/v1/reservation_service.move_assignment.js b/packages/google-cloud-bigquery-reservation/samples/generated/v1/reservation_service.move_assignment.js new file mode 100644 index 00000000000..d1db9490db7 --- /dev/null +++ b/packages/google-cloud-bigquery-reservation/samples/generated/v1/reservation_service.move_assignment.js @@ -0,0 +1,60 @@ +// 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 bigqueryreservation_v1_generated_ReservationService_MoveAssignment_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The resource name of the assignment, + * e.g. + * `projects/myproject/locations/US/reservations/team1-prod/assignments/123` + */ + // const name = 'abc123' + /** + * The new reservation ID, e.g.: + * `projects/myotherproject/locations/US/reservations/team2-prod` + */ + // const destinationId = 'abc123' + + // Imports the Reservation library + const {ReservationServiceClient} = + require('@google-cloud/bigquery-reservation').v1; + + // Instantiates a client + const reservationClient = new ReservationServiceClient(); + + async function moveAssignment() { + // Construct request + const request = { + name, + }; + + // Run request + const response = await reservationClient.moveAssignment(request); + console.log(response); + } + + moveAssignment(); + // [END bigqueryreservation_v1_generated_ReservationService_MoveAssignment_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-cloud-bigquery-reservation/samples/generated/v1/reservation_service.search_all_assignments.js b/packages/google-cloud-bigquery-reservation/samples/generated/v1/reservation_service.search_all_assignments.js new file mode 100644 index 00000000000..3f7340b4265 --- /dev/null +++ b/packages/google-cloud-bigquery-reservation/samples/generated/v1/reservation_service.search_all_assignments.js @@ -0,0 +1,73 @@ +// 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) { + // [START bigqueryreservation_v1_generated_ReservationService_SearchAllAssignments_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The resource name with location (project name could be the wildcard '-'), + * e.g.: + * `projects/-/locations/US`. + */ + // const parent = 'abc123' + /** + * Please specify resource name as assignee in the query. + * Examples: + * * `assignee=projects/myproject` + * * `assignee=folders/123` + * * `assignee=organizations/456` + */ + // const query = 'abc123' + /** + * The maximum number of items to return per page. + */ + // const pageSize = 1234 + /** + * The next_page_token value returned from a previous List request, if any. + */ + // const pageToken = 'abc123' + + // Imports the Reservation library + const {ReservationServiceClient} = + require('@google-cloud/bigquery-reservation').v1; + + // Instantiates a client + const reservationClient = new ReservationServiceClient(); + + async function searchAllAssignments() { + // Construct request + const request = { + parent, + }; + + // Run request + const iterable = await reservationClient.searchAllAssignmentsAsync(request); + for await (const response of iterable) { + console.log(response); + } + } + + searchAllAssignments(); + // [END bigqueryreservation_v1_generated_ReservationService_SearchAllAssignments_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-cloud-bigquery-reservation/samples/generated/v1/reservation_service.search_assignments.js b/packages/google-cloud-bigquery-reservation/samples/generated/v1/reservation_service.search_assignments.js new file mode 100644 index 00000000000..6353e6be98a --- /dev/null +++ b/packages/google-cloud-bigquery-reservation/samples/generated/v1/reservation_service.search_assignments.js @@ -0,0 +1,73 @@ +// 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) { + // [START bigqueryreservation_v1_generated_ReservationService_SearchAssignments_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The resource name of the admin project(containing project and location), + * e.g.: + * `projects/myproject/locations/US`. + */ + // const parent = 'abc123' + /** + * Please specify resource name as assignee in the query. + * Examples: + * * `assignee=projects/myproject` + * * `assignee=folders/123` + * * `assignee=organizations/456` + */ + // const query = 'abc123' + /** + * The maximum number of items to return per page. + */ + // const pageSize = 1234 + /** + * The next_page_token value returned from a previous List request, if any. + */ + // const pageToken = 'abc123' + + // Imports the Reservation library + const {ReservationServiceClient} = + require('@google-cloud/bigquery-reservation').v1; + + // Instantiates a client + const reservationClient = new ReservationServiceClient(); + + async function searchAssignments() { + // Construct request + const request = { + parent, + }; + + // Run request + const iterable = await reservationClient.searchAssignmentsAsync(request); + for await (const response of iterable) { + console.log(response); + } + } + + searchAssignments(); + // [END bigqueryreservation_v1_generated_ReservationService_SearchAssignments_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-cloud-bigquery-reservation/samples/generated/v1/reservation_service.split_capacity_commitment.js b/packages/google-cloud-bigquery-reservation/samples/generated/v1/reservation_service.split_capacity_commitment.js new file mode 100644 index 00000000000..8526addd8f4 --- /dev/null +++ b/packages/google-cloud-bigquery-reservation/samples/generated/v1/reservation_service.split_capacity_commitment.js @@ -0,0 +1,58 @@ +// 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 bigqueryreservation_v1_generated_ReservationService_SplitCapacityCommitment_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The resource name e.g.,: + * `projects/myproject/locations/US/capacityCommitments/123` + */ + // const name = 'abc123' + /** + * Number of slots in the capacity commitment after the split. + */ + // const slotCount = 1234 + + // Imports the Reservation library + const {ReservationServiceClient} = + require('@google-cloud/bigquery-reservation').v1; + + // Instantiates a client + const reservationClient = new ReservationServiceClient(); + + async function splitCapacityCommitment() { + // Construct request + const request = { + name, + }; + + // Run request + const response = await reservationClient.splitCapacityCommitment(request); + console.log(response); + } + + splitCapacityCommitment(); + // [END bigqueryreservation_v1_generated_ReservationService_SplitCapacityCommitment_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-cloud-bigquery-reservation/samples/generated/v1/reservation_service.update_bi_reservation.js b/packages/google-cloud-bigquery-reservation/samples/generated/v1/reservation_service.update_bi_reservation.js new file mode 100644 index 00000000000..d22943ad5c1 --- /dev/null +++ b/packages/google-cloud-bigquery-reservation/samples/generated/v1/reservation_service.update_bi_reservation.js @@ -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() { + // [START bigqueryreservation_v1_generated_ReservationService_UpdateBiReservation_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * A reservation to update. + */ + // const biReservation = '' + /** + * A list of fields to be updated in this request. + */ + // const updateMask = '' + + // Imports the Reservation library + const {ReservationServiceClient} = + require('@google-cloud/bigquery-reservation').v1; + + // Instantiates a client + const reservationClient = new ReservationServiceClient(); + + async function updateBiReservation() { + // Construct request + const request = {}; + + // Run request + const response = await reservationClient.updateBiReservation(request); + console.log(response); + } + + updateBiReservation(); + // [END bigqueryreservation_v1_generated_ReservationService_UpdateBiReservation_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-cloud-bigquery-reservation/samples/generated/v1/reservation_service.update_capacity_commitment.js b/packages/google-cloud-bigquery-reservation/samples/generated/v1/reservation_service.update_capacity_commitment.js new file mode 100644 index 00000000000..00fd5b391dc --- /dev/null +++ b/packages/google-cloud-bigquery-reservation/samples/generated/v1/reservation_service.update_capacity_commitment.js @@ -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() { + // [START bigqueryreservation_v1_generated_ReservationService_UpdateCapacityCommitment_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Content of the capacity commitment to update. + */ + // const capacityCommitment = '' + /** + * Standard field mask for the set of fields to be updated. + */ + // const updateMask = '' + + // Imports the Reservation library + const {ReservationServiceClient} = + require('@google-cloud/bigquery-reservation').v1; + + // Instantiates a client + const reservationClient = new ReservationServiceClient(); + + async function updateCapacityCommitment() { + // Construct request + const request = {}; + + // Run request + const response = await reservationClient.updateCapacityCommitment(request); + console.log(response); + } + + updateCapacityCommitment(); + // [END bigqueryreservation_v1_generated_ReservationService_UpdateCapacityCommitment_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-cloud-bigquery-reservation/samples/generated/v1/reservation_service.update_reservation.js b/packages/google-cloud-bigquery-reservation/samples/generated/v1/reservation_service.update_reservation.js new file mode 100644 index 00000000000..9847adecd50 --- /dev/null +++ b/packages/google-cloud-bigquery-reservation/samples/generated/v1/reservation_service.update_reservation.js @@ -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() { + // [START bigqueryreservation_v1_generated_ReservationService_UpdateReservation_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Content of the reservation to update. + */ + // const reservation = '' + /** + * Standard field mask for the set of fields to be updated. + */ + // const updateMask = '' + + // Imports the Reservation library + const {ReservationServiceClient} = + require('@google-cloud/bigquery-reservation').v1; + + // Instantiates a client + const reservationClient = new ReservationServiceClient(); + + async function updateReservation() { + // Construct request + const request = {}; + + // Run request + const response = await reservationClient.updateReservation(request); + console.log(response); + } + + updateReservation(); + // [END bigqueryreservation_v1_generated_ReservationService_UpdateReservation_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-cloud-bigquery-reservation/src/v1/reservation_service_client.ts b/packages/google-cloud-bigquery-reservation/src/v1/reservation_service_client.ts index 6a6e98ff232..14cde1e22ce 100644 --- a/packages/google-cloud-bigquery-reservation/src/v1/reservation_service_client.ts +++ b/packages/google-cloud-bigquery-reservation/src/v1/reservation_service_client.ts @@ -2135,7 +2135,8 @@ export class ReservationServiceClient { gax.routingHeader.fromParams({ parent: request.parent || '', }); - const callSettings = new gax.CallSettings(options); + const defaultCallSettings = this._defaults['listReservations']; + const callSettings = defaultCallSettings.merge(options); this.initialize(); return this.descriptors.page.listReservations.createStream( this.innerApiCalls.listReservations as gax.GaxCall, @@ -2186,7 +2187,8 @@ export class ReservationServiceClient { parent: request.parent || '', }); options = options || {}; - const callSettings = new gax.CallSettings(options); + const defaultCallSettings = this._defaults['listReservations']; + const callSettings = defaultCallSettings.merge(options); this.initialize(); return this.descriptors.page.listReservations.asyncIterate( this.innerApiCalls['listReservations'] as GaxCall, @@ -2333,7 +2335,8 @@ export class ReservationServiceClient { gax.routingHeader.fromParams({ parent: request.parent || '', }); - const callSettings = new gax.CallSettings(options); + const defaultCallSettings = this._defaults['listCapacityCommitments']; + const callSettings = defaultCallSettings.merge(options); this.initialize(); return this.descriptors.page.listCapacityCommitments.createStream( this.innerApiCalls.listCapacityCommitments as gax.GaxCall, @@ -2384,7 +2387,8 @@ export class ReservationServiceClient { parent: request.parent || '', }); options = options || {}; - const callSettings = new gax.CallSettings(options); + const defaultCallSettings = this._defaults['listCapacityCommitments']; + const callSettings = defaultCallSettings.merge(options); this.initialize(); return this.descriptors.page.listCapacityCommitments.asyncIterate( this.innerApiCalls['listCapacityCommitments'] as GaxCall, @@ -2557,7 +2561,8 @@ export class ReservationServiceClient { gax.routingHeader.fromParams({ parent: request.parent || '', }); - const callSettings = new gax.CallSettings(options); + const defaultCallSettings = this._defaults['listAssignments']; + const callSettings = defaultCallSettings.merge(options); this.initialize(); return this.descriptors.page.listAssignments.createStream( this.innerApiCalls.listAssignments as gax.GaxCall, @@ -2613,7 +2618,8 @@ export class ReservationServiceClient { parent: request.parent || '', }); options = options || {}; - const callSettings = new gax.CallSettings(options); + const defaultCallSettings = this._defaults['listAssignments']; + const callSettings = defaultCallSettings.merge(options); this.initialize(); return this.descriptors.page.listAssignments.asyncIterate( this.innerApiCalls['listAssignments'] as GaxCall, @@ -2803,7 +2809,8 @@ export class ReservationServiceClient { gax.routingHeader.fromParams({ parent: request.parent || '', }); - const callSettings = new gax.CallSettings(options); + const defaultCallSettings = this._defaults['searchAssignments']; + const callSettings = defaultCallSettings.merge(options); this.initialize(); this.warn( 'DEP$ReservationService-$SearchAssignments', @@ -2869,7 +2876,8 @@ export class ReservationServiceClient { parent: request.parent || '', }); options = options || {}; - const callSettings = new gax.CallSettings(options); + const defaultCallSettings = this._defaults['searchAssignments']; + const callSettings = defaultCallSettings.merge(options); this.initialize(); this.warn( 'DEP$ReservationService-$SearchAssignments', @@ -3054,7 +3062,8 @@ export class ReservationServiceClient { gax.routingHeader.fromParams({ parent: request.parent || '', }); - const callSettings = new gax.CallSettings(options); + const defaultCallSettings = this._defaults['searchAllAssignments']; + const callSettings = defaultCallSettings.merge(options); this.initialize(); return this.descriptors.page.searchAllAssignments.createStream( this.innerApiCalls.searchAllAssignments as gax.GaxCall, @@ -3114,7 +3123,8 @@ export class ReservationServiceClient { parent: request.parent || '', }); options = options || {}; - const callSettings = new gax.CallSettings(options); + const defaultCallSettings = this._defaults['searchAllAssignments']; + const callSettings = defaultCallSettings.merge(options); this.initialize(); return this.descriptors.page.searchAllAssignments.asyncIterate( this.innerApiCalls['searchAllAssignments'] as GaxCall,