From fb922191267b6a23d67e42b2aaea9b7e30506bd6 Mon Sep 17 00:00:00 2001 From: Owl Bot Date: Wed, 22 Mar 2023 18:09:13 +0000 Subject: [PATCH 1/2] feat: add edition/autoscale related fields PiperOrigin-RevId: 518584143 Source-Link: https://github.com/googleapis/googleapis/commit/e4a7ae691c2b3f5448e1d7ab9831aca3e1e6d0ec Source-Link: https://github.com/googleapis/googleapis-gen/commit/f3e8c09d10c859ff4e267b7e1a3bcaecc56d5bef Copy-Tag: eyJwIjoicGFja2FnZXMvZ29vZ2xlLWNsb3VkLWJpZ3F1ZXJ5LXJlc2VydmF0aW9uLy5Pd2xCb3QueWFtbCIsImgiOiJmM2U4YzA5ZDEwYzg1OWZmNGUyNjdiN2UxYTNiY2FlY2M1NmQ1YmVmIn0= --- .../v1/.eslintignore | 7 + .../v1/.eslintrc.json | 3 + .../v1/.gitignore | 14 + .../v1/.jsdoc.js | 55 + .../v1/.mocharc.js | 33 + .../v1/.prettierrc.js | 22 + .../v1/README.md | 1 + .../v1/linkinator.config.json | 16 + .../v1/package.json | 64 + .../bigquery/reservation/v1/reservation.proto | 1171 ++++++ .../reservation_service.create_assignment.js | 73 + ...tion_service.create_capacity_commitment.js | 79 + .../reservation_service.create_reservation.js | 72 + .../reservation_service.delete_assignment.js | 62 + ...tion_service.delete_capacity_commitment.js | 68 + .../reservation_service.delete_reservation.js | 62 + .../reservation_service.get_bi_reservation.js | 62 + ...rvation_service.get_capacity_commitment.js | 62 + .../v1/reservation_service.get_reservation.js | 62 + .../reservation_service.list_assignments.js | 74 + ...ation_service.list_capacity_commitments.js | 72 + .../reservation_service.list_reservations.js | 72 + ...tion_service.merge_capacity_commitments.js | 69 + .../v1/reservation_service.move_assignment.js | 75 + ...ervation_service.search_all_assignments.js | 81 + .../reservation_service.search_assignments.js | 81 + ...ation_service.split_capacity_commitment.js | 66 + .../reservation_service.update_assignment.js | 64 + ...servation_service.update_bi_reservation.js | 64 + ...tion_service.update_capacity_commitment.js | 64 + .../reservation_service.update_reservation.js | 64 + ....google.cloud.bigquery.reservation.v1.json | 967 +++++ .../v1/src/index.ts | 25 + .../v1/src/v1/gapic_metadata.json | 253 ++ .../v1/src/v1/index.ts | 19 + .../v1/src/v1/reservation_service_client.ts | 2924 ++++++++++++++ .../v1/reservation_service_client_config.json | 129 + .../v1/reservation_service_proto_list.json | 3 + .../system-test/fixtures/sample/src/index.js | 27 + .../system-test/fixtures/sample/src/index.ts | 32 + .../v1/system-test/install.ts | 49 + .../v1/test/gapic_reservation_service_v1.ts | 3435 +++++++++++++++++ .../v1/tsconfig.json | 19 + .../v1/webpack.config.js | 64 + 44 files changed, 10780 insertions(+) create mode 100644 owl-bot-staging/google-cloud-bigquery-reservation/v1/.eslintignore create mode 100644 owl-bot-staging/google-cloud-bigquery-reservation/v1/.eslintrc.json create mode 100644 owl-bot-staging/google-cloud-bigquery-reservation/v1/.gitignore create mode 100644 owl-bot-staging/google-cloud-bigquery-reservation/v1/.jsdoc.js create mode 100644 owl-bot-staging/google-cloud-bigquery-reservation/v1/.mocharc.js create mode 100644 owl-bot-staging/google-cloud-bigquery-reservation/v1/.prettierrc.js create mode 100644 owl-bot-staging/google-cloud-bigquery-reservation/v1/README.md create mode 100644 owl-bot-staging/google-cloud-bigquery-reservation/v1/linkinator.config.json create mode 100644 owl-bot-staging/google-cloud-bigquery-reservation/v1/package.json create mode 100644 owl-bot-staging/google-cloud-bigquery-reservation/v1/protos/google/cloud/bigquery/reservation/v1/reservation.proto create mode 100644 owl-bot-staging/google-cloud-bigquery-reservation/v1/samples/generated/v1/reservation_service.create_assignment.js create mode 100644 owl-bot-staging/google-cloud-bigquery-reservation/v1/samples/generated/v1/reservation_service.create_capacity_commitment.js create mode 100644 owl-bot-staging/google-cloud-bigquery-reservation/v1/samples/generated/v1/reservation_service.create_reservation.js create mode 100644 owl-bot-staging/google-cloud-bigquery-reservation/v1/samples/generated/v1/reservation_service.delete_assignment.js create mode 100644 owl-bot-staging/google-cloud-bigquery-reservation/v1/samples/generated/v1/reservation_service.delete_capacity_commitment.js create mode 100644 owl-bot-staging/google-cloud-bigquery-reservation/v1/samples/generated/v1/reservation_service.delete_reservation.js create mode 100644 owl-bot-staging/google-cloud-bigquery-reservation/v1/samples/generated/v1/reservation_service.get_bi_reservation.js create mode 100644 owl-bot-staging/google-cloud-bigquery-reservation/v1/samples/generated/v1/reservation_service.get_capacity_commitment.js create mode 100644 owl-bot-staging/google-cloud-bigquery-reservation/v1/samples/generated/v1/reservation_service.get_reservation.js create mode 100644 owl-bot-staging/google-cloud-bigquery-reservation/v1/samples/generated/v1/reservation_service.list_assignments.js create mode 100644 owl-bot-staging/google-cloud-bigquery-reservation/v1/samples/generated/v1/reservation_service.list_capacity_commitments.js create mode 100644 owl-bot-staging/google-cloud-bigquery-reservation/v1/samples/generated/v1/reservation_service.list_reservations.js create mode 100644 owl-bot-staging/google-cloud-bigquery-reservation/v1/samples/generated/v1/reservation_service.merge_capacity_commitments.js create mode 100644 owl-bot-staging/google-cloud-bigquery-reservation/v1/samples/generated/v1/reservation_service.move_assignment.js create mode 100644 owl-bot-staging/google-cloud-bigquery-reservation/v1/samples/generated/v1/reservation_service.search_all_assignments.js create mode 100644 owl-bot-staging/google-cloud-bigquery-reservation/v1/samples/generated/v1/reservation_service.search_assignments.js create mode 100644 owl-bot-staging/google-cloud-bigquery-reservation/v1/samples/generated/v1/reservation_service.split_capacity_commitment.js create mode 100644 owl-bot-staging/google-cloud-bigquery-reservation/v1/samples/generated/v1/reservation_service.update_assignment.js create mode 100644 owl-bot-staging/google-cloud-bigquery-reservation/v1/samples/generated/v1/reservation_service.update_bi_reservation.js create mode 100644 owl-bot-staging/google-cloud-bigquery-reservation/v1/samples/generated/v1/reservation_service.update_capacity_commitment.js create mode 100644 owl-bot-staging/google-cloud-bigquery-reservation/v1/samples/generated/v1/reservation_service.update_reservation.js create mode 100644 owl-bot-staging/google-cloud-bigquery-reservation/v1/samples/generated/v1/snippet_metadata.google.cloud.bigquery.reservation.v1.json create mode 100644 owl-bot-staging/google-cloud-bigquery-reservation/v1/src/index.ts create mode 100644 owl-bot-staging/google-cloud-bigquery-reservation/v1/src/v1/gapic_metadata.json create mode 100644 owl-bot-staging/google-cloud-bigquery-reservation/v1/src/v1/index.ts create mode 100644 owl-bot-staging/google-cloud-bigquery-reservation/v1/src/v1/reservation_service_client.ts create mode 100644 owl-bot-staging/google-cloud-bigquery-reservation/v1/src/v1/reservation_service_client_config.json create mode 100644 owl-bot-staging/google-cloud-bigquery-reservation/v1/src/v1/reservation_service_proto_list.json create mode 100644 owl-bot-staging/google-cloud-bigquery-reservation/v1/system-test/fixtures/sample/src/index.js create mode 100644 owl-bot-staging/google-cloud-bigquery-reservation/v1/system-test/fixtures/sample/src/index.ts create mode 100644 owl-bot-staging/google-cloud-bigquery-reservation/v1/system-test/install.ts create mode 100644 owl-bot-staging/google-cloud-bigquery-reservation/v1/test/gapic_reservation_service_v1.ts create mode 100644 owl-bot-staging/google-cloud-bigquery-reservation/v1/tsconfig.json create mode 100644 owl-bot-staging/google-cloud-bigquery-reservation/v1/webpack.config.js diff --git a/owl-bot-staging/google-cloud-bigquery-reservation/v1/.eslintignore b/owl-bot-staging/google-cloud-bigquery-reservation/v1/.eslintignore new file mode 100644 index 00000000000..cfc348ec4d1 --- /dev/null +++ b/owl-bot-staging/google-cloud-bigquery-reservation/v1/.eslintignore @@ -0,0 +1,7 @@ +**/node_modules +**/.coverage +build/ +docs/ +protos/ +system-test/ +samples/generated/ diff --git a/owl-bot-staging/google-cloud-bigquery-reservation/v1/.eslintrc.json b/owl-bot-staging/google-cloud-bigquery-reservation/v1/.eslintrc.json new file mode 100644 index 00000000000..78215349546 --- /dev/null +++ b/owl-bot-staging/google-cloud-bigquery-reservation/v1/.eslintrc.json @@ -0,0 +1,3 @@ +{ + "extends": "./node_modules/gts" +} diff --git a/owl-bot-staging/google-cloud-bigquery-reservation/v1/.gitignore b/owl-bot-staging/google-cloud-bigquery-reservation/v1/.gitignore new file mode 100644 index 00000000000..d4f03a0df2e --- /dev/null +++ b/owl-bot-staging/google-cloud-bigquery-reservation/v1/.gitignore @@ -0,0 +1,14 @@ +**/*.log +**/node_modules +/.coverage +/coverage +/.nyc_output +/docs/ +/out/ +/build/ +system-test/secrets.js +system-test/*key.json +*.lock +.DS_Store +package-lock.json +__pycache__ diff --git a/owl-bot-staging/google-cloud-bigquery-reservation/v1/.jsdoc.js b/owl-bot-staging/google-cloud-bigquery-reservation/v1/.jsdoc.js new file mode 100644 index 00000000000..7feca2a65aa --- /dev/null +++ b/owl-bot-staging/google-cloud-bigquery-reservation/v1/.jsdoc.js @@ -0,0 +1,55 @@ +// Copyright 2023 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 +// +// https://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. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + +'use strict'; + +module.exports = { + opts: { + readme: './README.md', + package: './package.json', + template: './node_modules/jsdoc-fresh', + recurse: true, + verbose: true, + destination: './docs/' + }, + plugins: [ + 'plugins/markdown', + 'jsdoc-region-tag' + ], + source: { + excludePattern: '(^|\\/|\\\\)[._]', + include: [ + 'build/src', + 'protos' + ], + includePattern: '\\.js$' + }, + templates: { + copyright: 'Copyright 2023 Google LLC', + includeDate: false, + sourceFiles: false, + systemName: '@google-cloud/bigquery-reservation', + theme: 'lumen', + default: { + outputSourceFiles: false + } + }, + markdown: { + idInHeadings: true + } +}; diff --git a/owl-bot-staging/google-cloud-bigquery-reservation/v1/.mocharc.js b/owl-bot-staging/google-cloud-bigquery-reservation/v1/.mocharc.js new file mode 100644 index 00000000000..1a38f257db7 --- /dev/null +++ b/owl-bot-staging/google-cloud-bigquery-reservation/v1/.mocharc.js @@ -0,0 +1,33 @@ +// Copyright 2023 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 +// +// https://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. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + +const config = { + "enable-source-maps": true, + "throw-deprecation": true, + "timeout": 10000 +} +if (process.env.MOCHA_THROW_DEPRECATION === 'false') { + delete config['throw-deprecation']; +} +if (process.env.MOCHA_REPORTER) { + config.reporter = process.env.MOCHA_REPORTER; +} +if (process.env.MOCHA_REPORTER_OUTPUT) { + config['reporter-option'] = `output=${process.env.MOCHA_REPORTER_OUTPUT}`; +} +module.exports = config diff --git a/owl-bot-staging/google-cloud-bigquery-reservation/v1/.prettierrc.js b/owl-bot-staging/google-cloud-bigquery-reservation/v1/.prettierrc.js new file mode 100644 index 00000000000..55639e70f9e --- /dev/null +++ b/owl-bot-staging/google-cloud-bigquery-reservation/v1/.prettierrc.js @@ -0,0 +1,22 @@ +// Copyright 2023 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 +// +// https://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. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + +module.exports = { + ...require('gts/.prettierrc.json') +} diff --git a/owl-bot-staging/google-cloud-bigquery-reservation/v1/README.md b/owl-bot-staging/google-cloud-bigquery-reservation/v1/README.md new file mode 100644 index 00000000000..03e19927b99 --- /dev/null +++ b/owl-bot-staging/google-cloud-bigquery-reservation/v1/README.md @@ -0,0 +1 @@ +Reservation: Nodejs Client diff --git a/owl-bot-staging/google-cloud-bigquery-reservation/v1/linkinator.config.json b/owl-bot-staging/google-cloud-bigquery-reservation/v1/linkinator.config.json new file mode 100644 index 00000000000..befd23c8633 --- /dev/null +++ b/owl-bot-staging/google-cloud-bigquery-reservation/v1/linkinator.config.json @@ -0,0 +1,16 @@ +{ + "recurse": true, + "skip": [ + "https://codecov.io/gh/googleapis/", + "www.googleapis.com", + "img.shields.io", + "https://console.cloud.google.com/cloudshell", + "https://support.google.com" + ], + "silent": true, + "concurrency": 5, + "retry": true, + "retryErrors": true, + "retryErrorsCount": 5, + "retryErrorsJitter": 3000 +} diff --git a/owl-bot-staging/google-cloud-bigquery-reservation/v1/package.json b/owl-bot-staging/google-cloud-bigquery-reservation/v1/package.json new file mode 100644 index 00000000000..09514ddcbe1 --- /dev/null +++ b/owl-bot-staging/google-cloud-bigquery-reservation/v1/package.json @@ -0,0 +1,64 @@ +{ + "name": "@google-cloud/bigquery-reservation", + "version": "0.1.0", + "description": "Reservation client for Node.js", + "repository": "googleapis/nodejs-reservation", + "license": "Apache-2.0", + "author": "Google LLC", + "main": "build/src/index.js", + "files": [ + "build/src", + "build/protos" + ], + "keywords": [ + "google apis client", + "google api client", + "google apis", + "google api", + "google", + "google cloud platform", + "google cloud", + "cloud", + "google reservation", + "reservation", + "reservation service" + ], + "scripts": { + "clean": "gts clean", + "compile": "tsc -p . && cp -r protos build/ && minifyProtoJson", + "compile-protos": "compileProtos src", + "docs": "jsdoc -c .jsdoc.js", + "predocs-test": "npm run docs", + "docs-test": "linkinator docs", + "fix": "gts fix", + "lint": "gts check", + "prepare": "npm run compile-protos && npm run compile", + "system-test": "c8 mocha build/system-test", + "test": "c8 mocha build/test" + }, + "dependencies": { + "google-gax": "^3.5.7" + }, + "devDependencies": { + "@types/mocha": "^10.0.1", + "@types/node": "^18.11.18", + "@types/sinon": "^10.0.13", + "c8": "^7.12.0", + "gts": "^3.1.1", + "jsdoc": "^4.0.0", + "jsdoc-fresh": "^2.0.1", + "jsdoc-region-tag": "^2.0.1", + "linkinator": "^4.1.2", + "mocha": "^10.2.0", + "null-loader": "^4.0.1", + "pack-n-play": "^1.0.0-2", + "sinon": "^15.0.1", + "ts-loader": "^8.4.0", + "typescript": "^4.8.4", + "webpack": "^4.46.0", + "webpack-cli": "^4.10.0" + }, + "engines": { + "node": ">=v12" + } +} diff --git a/owl-bot-staging/google-cloud-bigquery-reservation/v1/protos/google/cloud/bigquery/reservation/v1/reservation.proto b/owl-bot-staging/google-cloud-bigquery-reservation/v1/protos/google/cloud/bigquery/reservation/v1/reservation.proto new file mode 100644 index 00000000000..6be4b70a0e1 --- /dev/null +++ b/owl-bot-staging/google-cloud-bigquery-reservation/v1/protos/google/cloud/bigquery/reservation/v1/reservation.proto @@ -0,0 +1,1171 @@ +// Copyright 2023 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. + +syntax = "proto3"; + +package google.cloud.bigquery.reservation.v1; + +import "google/api/annotations.proto"; +import "google/api/client.proto"; +import "google/api/field_behavior.proto"; +import "google/api/resource.proto"; +import "google/protobuf/empty.proto"; +import "google/protobuf/field_mask.proto"; +import "google/protobuf/timestamp.proto"; +import "google/rpc/status.proto"; + +option csharp_namespace = "Google.Cloud.BigQuery.Reservation.V1"; +option go_package = "cloud.google.com/go/bigquery/reservation/apiv1/reservationpb;reservationpb"; +option java_multiple_files = true; +option java_outer_classname = "ReservationProto"; +option java_package = "com.google.cloud.bigquery.reservation.v1"; +option php_namespace = "Google\\Cloud\\BigQuery\\Reservation\\V1"; + +// This API allows users to manage their flat-rate BigQuery reservations. +// +// A reservation provides computational resource guarantees, in the form of +// [slots](https://cloud.google.com/bigquery/docs/slots), to users. A slot is a +// unit of computational power in BigQuery, and serves as the basic unit of +// parallelism. In a scan of a multi-partitioned table, a single slot operates +// on a single partition of the table. A reservation resource exists as a child +// resource of the admin project and location, e.g.: +// `projects/myproject/locations/US/reservations/reservationName`. +// +// A capacity commitment is a way to purchase compute capacity for BigQuery jobs +// (in the form of slots) with some committed period of usage. A capacity +// commitment resource exists as a child resource of the admin project and +// location, e.g.: +// `projects/myproject/locations/US/capacityCommitments/id`. +service ReservationService { + option (google.api.default_host) = "bigqueryreservation.googleapis.com"; + option (google.api.oauth_scopes) = + "https://www.googleapis.com/auth/bigquery," + "https://www.googleapis.com/auth/cloud-platform"; + + // Creates a new reservation resource. + rpc CreateReservation(CreateReservationRequest) returns (Reservation) { + option (google.api.http) = { + post: "/v1/{parent=projects/*/locations/*}/reservations" + body: "reservation" + }; + option (google.api.method_signature) = "parent,reservation,reservation_id"; + } + + // Lists all the reservations for the project in the specified location. + rpc ListReservations(ListReservationsRequest) + returns (ListReservationsResponse) { + option (google.api.http) = { + get: "/v1/{parent=projects/*/locations/*}/reservations" + }; + option (google.api.method_signature) = "parent"; + } + + // Returns information about the reservation. + rpc GetReservation(GetReservationRequest) returns (Reservation) { + option (google.api.http) = { + get: "/v1/{name=projects/*/locations/*/reservations/*}" + }; + option (google.api.method_signature) = "name"; + } + + // Deletes a reservation. + // Returns `google.rpc.Code.FAILED_PRECONDITION` when reservation has + // assignments. + rpc DeleteReservation(DeleteReservationRequest) + returns (google.protobuf.Empty) { + option (google.api.http) = { + delete: "/v1/{name=projects/*/locations/*/reservations/*}" + }; + option (google.api.method_signature) = "name"; + } + + // Updates an existing reservation resource. + rpc UpdateReservation(UpdateReservationRequest) returns (Reservation) { + option (google.api.http) = { + patch: "/v1/{reservation.name=projects/*/locations/*/reservations/*}" + body: "reservation" + }; + option (google.api.method_signature) = "reservation,update_mask"; + } + + // Creates a new capacity commitment resource. + rpc CreateCapacityCommitment(CreateCapacityCommitmentRequest) + returns (CapacityCommitment) { + option (google.api.http) = { + post: "/v1/{parent=projects/*/locations/*}/capacityCommitments" + body: "capacity_commitment" + }; + option (google.api.method_signature) = "parent,capacity_commitment"; + } + + // Lists all the capacity commitments for the admin project. + rpc ListCapacityCommitments(ListCapacityCommitmentsRequest) + returns (ListCapacityCommitmentsResponse) { + option (google.api.http) = { + get: "/v1/{parent=projects/*/locations/*}/capacityCommitments" + }; + option (google.api.method_signature) = "parent"; + } + + // Returns information about the capacity commitment. + rpc GetCapacityCommitment(GetCapacityCommitmentRequest) + returns (CapacityCommitment) { + option (google.api.http) = { + get: "/v1/{name=projects/*/locations/*/capacityCommitments/*}" + }; + option (google.api.method_signature) = "name"; + } + + // Deletes a capacity commitment. Attempting to delete capacity commitment + // before its commitment_end_time will fail with the error code + // `google.rpc.Code.FAILED_PRECONDITION`. + rpc DeleteCapacityCommitment(DeleteCapacityCommitmentRequest) + returns (google.protobuf.Empty) { + option (google.api.http) = { + delete: "/v1/{name=projects/*/locations/*/capacityCommitments/*}" + }; + option (google.api.method_signature) = "name"; + } + + // Updates an existing capacity commitment. + // + // Only `plan` and `renewal_plan` fields can be updated. + // + // Plan can only be changed to a plan of a longer commitment period. + // Attempting to change to a plan with shorter commitment period will fail + // with the error code `google.rpc.Code.FAILED_PRECONDITION`. + rpc UpdateCapacityCommitment(UpdateCapacityCommitmentRequest) + returns (CapacityCommitment) { + option (google.api.http) = { + patch: "/v1/{capacity_commitment.name=projects/*/locations/*/capacityCommitments/*}" + body: "capacity_commitment" + }; + option (google.api.method_signature) = "capacity_commitment,update_mask"; + } + + // Splits capacity commitment to two commitments of the same plan and + // `commitment_end_time`. + // + // A common use case is to enable downgrading commitments. + // + // For example, in order to downgrade from 10000 slots to 8000, you might + // split a 10000 capacity commitment into commitments of 2000 and 8000. Then, + // you delete the first one after the commitment end time passes. + rpc SplitCapacityCommitment(SplitCapacityCommitmentRequest) + returns (SplitCapacityCommitmentResponse) { + option (google.api.http) = { + post: "/v1/{name=projects/*/locations/*/capacityCommitments/*}:split" + body: "*" + }; + option (google.api.method_signature) = "name,slot_count"; + } + + // Merges capacity commitments of the same plan into a single commitment. + // + // The resulting capacity commitment has the greater commitment_end_time + // out of the to-be-merged capacity commitments. + // + // Attempting to merge capacity commitments of different plan will fail + // with the error code `google.rpc.Code.FAILED_PRECONDITION`. + rpc MergeCapacityCommitments(MergeCapacityCommitmentsRequest) + returns (CapacityCommitment) { + option (google.api.http) = { + post: "/v1/{parent=projects/*/locations/*}/capacityCommitments:merge" + body: "*" + }; + option (google.api.method_signature) = "parent,capacity_commitment_ids"; + } + + // Creates an assignment object which allows the given project to submit jobs + // of a certain type using slots from the specified reservation. + // + // Currently a + // resource (project, folder, organization) can only have one assignment per + // each (job_type, location) combination, and that reservation will be used + // for all jobs of the matching type. + // + // Different assignments can be created on different levels of the + // projects, folders or organization hierarchy. During query execution, + // the assignment is looked up at the project, folder and organization levels + // in that order. The first assignment found is applied to the query. + // + // When creating assignments, it does not matter if other assignments exist at + // higher levels. + // + // Example: + // + // * The organization `organizationA` contains two projects, `project1` + // and `project2`. + // * Assignments for all three entities (`organizationA`, `project1`, and + // `project2`) could all be created and mapped to the same or different + // reservations. + // + // "None" assignments represent an absence of the assignment. Projects + // assigned to None use on-demand pricing. To create a "None" assignment, use + // "none" as a reservation_id in the parent. Example parent: + // `projects/myproject/locations/US/reservations/none`. + // + // Returns `google.rpc.Code.PERMISSION_DENIED` if user does not have + // 'bigquery.admin' permissions on the project using the reservation + // and the project that owns this reservation. + // + // Returns `google.rpc.Code.INVALID_ARGUMENT` when location of the assignment + // does not match location of the reservation. + rpc CreateAssignment(CreateAssignmentRequest) returns (Assignment) { + option (google.api.http) = { + post: "/v1/{parent=projects/*/locations/*/reservations/*}/assignments" + body: "assignment" + }; + option (google.api.method_signature) = "parent,assignment"; + } + + // Lists assignments. + // + // Only explicitly created assignments will be returned. + // + // Example: + // + // * Organization `organizationA` contains two projects, `project1` and + // `project2`. + // * Reservation `res1` exists and was created previously. + // * CreateAssignment was used previously to define the following + // associations between entities and reservations: `` + // and `` + // + // In this example, ListAssignments will just return the above two assignments + // for reservation `res1`, and no expansion/merge will happen. + // + // The wildcard "-" can be used for + // reservations in the request. In that case all assignments belongs to the + // specified project and location will be listed. + // + // **Note** "-" cannot be used for projects nor locations. + rpc ListAssignments(ListAssignmentsRequest) + returns (ListAssignmentsResponse) { + option (google.api.http) = { + get: "/v1/{parent=projects/*/locations/*/reservations/*}/assignments" + }; + option (google.api.method_signature) = "parent"; + } + + // Deletes a assignment. No expansion will happen. + // + // Example: + // + // * Organization `organizationA` contains two projects, `project1` and + // `project2`. + // * Reservation `res1` exists and was created previously. + // * CreateAssignment was used previously to define the following + // associations between entities and reservations: `` + // and `` + // + // In this example, deletion of the `` assignment won't + // affect the other assignment ``. After said deletion, + // queries from `project1` will still use `res1` while queries from + // `project2` will switch to use on-demand mode. + rpc DeleteAssignment(DeleteAssignmentRequest) + returns (google.protobuf.Empty) { + option (google.api.http) = { + delete: "/v1/{name=projects/*/locations/*/reservations/*/assignments/*}" + }; + option (google.api.method_signature) = "name"; + } + + // Deprecated: Looks up assignments for a specified resource for a particular + // region. If the request is about a project: + // + // 1. Assignments created on the project will be returned if they exist. + // 2. Otherwise assignments created on the closest ancestor will be + // returned. + // 3. Assignments for different JobTypes will all be returned. + // + // The same logic applies if the request is about a folder. + // + // If the request is about an organization, then assignments created on the + // organization will be returned (organization doesn't have ancestors). + // + // Comparing to ListAssignments, there are some behavior + // differences: + // + // 1. permission on the assignee will be verified in this API. + // 2. Hierarchy lookup (project->folder->organization) happens in this API. + // 3. Parent here is `projects/*/locations/*`, instead of + // `projects/*/locations/*reservations/*`. + // + // **Note** "-" cannot be used for projects + // nor locations. + rpc SearchAssignments(SearchAssignmentsRequest) + returns (SearchAssignmentsResponse) { + option deprecated = true; + option (google.api.http) = { + get: "/v1/{parent=projects/*/locations/*}:searchAssignments" + }; + option (google.api.method_signature) = "parent,query"; + } + + // Looks up assignments for a specified resource for a particular region. + // If the request is about a project: + // + // 1. Assignments created on the project will be returned if they exist. + // 2. Otherwise assignments created on the closest ancestor will be + // returned. + // 3. Assignments for different JobTypes will all be returned. + // + // The same logic applies if the request is about a folder. + // + // If the request is about an organization, then assignments created on the + // organization will be returned (organization doesn't have ancestors). + // + // Comparing to ListAssignments, there are some behavior + // differences: + // + // 1. permission on the assignee will be verified in this API. + // 2. Hierarchy lookup (project->folder->organization) happens in this API. + // 3. Parent here is `projects/*/locations/*`, instead of + // `projects/*/locations/*reservations/*`. + rpc SearchAllAssignments(SearchAllAssignmentsRequest) + returns (SearchAllAssignmentsResponse) { + option (google.api.http) = { + get: "/v1/{parent=projects/*/locations/*}:searchAllAssignments" + }; + option (google.api.method_signature) = "parent,query"; + } + + // Moves an assignment under a new reservation. + // + // This differs from removing an existing assignment and recreating a new one + // by providing a transactional change that ensures an assignee always has an + // associated reservation. + rpc MoveAssignment(MoveAssignmentRequest) returns (Assignment) { + option (google.api.http) = { + post: "/v1/{name=projects/*/locations/*/reservations/*/assignments/*}:move" + body: "*" + }; + option (google.api.method_signature) = "name,destination_id"; + } + + // Updates an existing assignment. + // + // Only the `priority` field can be updated. + rpc UpdateAssignment(UpdateAssignmentRequest) returns (Assignment) { + option (google.api.http) = { + patch: "/v1/{assignment.name=projects/*/locations/*/reservations/*/assignments/*}" + body: "assignment" + }; + option (google.api.method_signature) = "assignment,update_mask"; + } + + // Retrieves a BI reservation. + rpc GetBiReservation(GetBiReservationRequest) returns (BiReservation) { + option (google.api.http) = { + get: "/v1/{name=projects/*/locations/*/biReservation}" + }; + option (google.api.method_signature) = "name"; + } + + // Updates a BI reservation. + // + // Only fields specified in the `field_mask` are updated. + // + // A singleton BI reservation always exists with default size 0. + // In order to reserve BI capacity it needs to be updated to an amount + // greater than 0. In order to release BI capacity reservation size + // must be set to 0. + rpc UpdateBiReservation(UpdateBiReservationRequest) returns (BiReservation) { + option (google.api.http) = { + patch: "/v1/{bi_reservation.name=projects/*/locations/*/biReservation}" + body: "bi_reservation" + }; + option (google.api.method_signature) = "bi_reservation,update_mask"; + } +} + +// A reservation is a mechanism used to guarantee slots to users. +message Reservation { + option (google.api.resource) = { + type: "bigqueryreservation.googleapis.com/Reservation" + pattern: "projects/{project}/locations/{location}/reservations/{reservation}" + }; + + // Auto scaling settings. + message Autoscale { + // Output only. The slot capacity added to this reservation when autoscale + // happens. Will be between [0, max_slots]. + int64 current_slots = 1 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Number of slots to be scaled when needed. + int64 max_slots = 2; + } + + // The resource name of the reservation, e.g., + // `projects/*/locations/*/reservations/team1-prod`. + // The reservation_id must only contain lower case alphanumeric characters or + // dashes. It must start with a letter and must not end with a dash. Its + // maximum length is 64 characters. + string name = 1; + + // Minimum slots available to this reservation. A slot is a unit of + // computational power in BigQuery, and serves as the unit of parallelism. + // + // Queries using this reservation might use more slots during runtime if + // ignore_idle_slots is set to false. + // + // If total slot_capacity of the reservation and its siblings + // exceeds the total slot_count of all capacity commitments, the request will + // fail with `google.rpc.Code.RESOURCE_EXHAUSTED`. + // + // + // NOTE: for reservations in US or EU multi-regions, slot capacity constraints + // are checked separately for default and auxiliary regions. See + // multi_region_auxiliary flag for more details. + int64 slot_capacity = 2; + + // If false, any query or pipeline job using this reservation will use idle + // slots from other reservations within the same admin project. If true, a + // query or pipeline job using this reservation will execute with the slot + // capacity specified in the slot_capacity field at most. + bool ignore_idle_slots = 4; + + // The configuration parameters for the auto scaling feature. Note this is an + // alpha feature. + Autoscale autoscale = 7; + + // Job concurrency target which sets a soft upper bound on the number of jobs + // that can run concurrently in this reservation. This is a soft target due to + // asynchronous nature of the system and various optimizations for small + // queries. + // Default value is 0 which means that concurrency target will be + // automatically computed by the system. + // NOTE: this field is exposed as `target_job_concurrency` in the Information + // Schema, DDL and BQ CLI. + int64 concurrency = 16; + + // Output only. Creation time of the reservation. + google.protobuf.Timestamp creation_time = 8 + [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. Last update time of the reservation. + google.protobuf.Timestamp update_time = 9 + [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Applicable only for reservations located within one of the BigQuery + // multi-regions (US or EU). + // + // If set to true, this reservation is placed in the organization's + // secondary region which is designated for disaster recovery purposes. + // If false, this reservation is placed in the organization's default region. + bool multi_region_auxiliary = 14; + + // Edition of the reservation. + Edition edition = 17; +} + +// Capacity commitment is a way to purchase compute capacity for BigQuery jobs +// (in the form of slots) with some committed period of usage. Annual +// commitments renew by default. Commitments can be removed after their +// commitment end time passes. +// +// In order to remove annual commitment, its plan needs to be changed +// to monthly or flex first. +// +// A capacity commitment resource exists as a child resource of the admin +// project. +message CapacityCommitment { + option (google.api.resource) = { + type: "bigqueryreservation.googleapis.com/CapacityCommitment" + pattern: "projects/{project}/locations/{location}/capacityCommitments/{capacity_commitment}" + }; + + // Commitment plan defines the current committed period. Capacity commitment + // cannot be deleted during it's committed period. + enum CommitmentPlan { + // Invalid plan value. Requests with this value will be rejected with + // error code `google.rpc.Code.INVALID_ARGUMENT`. + COMMITMENT_PLAN_UNSPECIFIED = 0; + + // Flex commitments have committed period of 1 minute after becoming ACTIVE. + // After that, they are not in a committed period anymore and can be removed + // any time. + FLEX = 3; + + // Same as FLEX, should only be used if flat-rate commitments are still + // available. + FLEX_FLAT_RATE = 7; + + // Trial commitments have a committed period of 182 days after becoming + // ACTIVE. After that, they are converted to a new commitment based on the + // `renewal_plan`. Default `renewal_plan` for Trial commitment is Flex so + // that it can be deleted right after committed period ends. + TRIAL = 5; + + // Monthly commitments have a committed period of 30 days after becoming + // ACTIVE. After that, they are not in a committed period anymore and can be + // removed any time. + MONTHLY = 2; + + // Same as MONTHLY, should only be used if flat-rate commitments are still + // available. + MONTHLY_FLAT_RATE = 8; + + // Annual commitments have a committed period of 365 days after becoming + // ACTIVE. After that they are converted to a new commitment based on the + // renewal_plan. + ANNUAL = 4; + + // Same as ANNUAL, should only be used if flat-rate commitments are still + // available. + ANNUAL_FLAT_RATE = 9; + + // 3-year commitments have a committed period of 1095(3 * 365) days after + // becoming ACTIVE. After that they are converted to a new commitment based + // on the renewal_plan. + THREE_YEAR = 10; + + // Should only be used for `renewal_plan` and is only meaningful if + // edition is specified to values other than EDITION_UNSPECIFIED. Otherwise + // CreateCapacityCommitmentRequest or UpdateCapacityCommitmentRequest will + // be rejected with error code `google.rpc.Code.INVALID_ARGUMENT`. If the + // renewal_plan is NONE, capacity commitment will be removed at the end of + // its commitment period. + NONE = 6; + } + + // Capacity commitment can either become ACTIVE right away or transition + // from PENDING to ACTIVE or FAILED. + enum State { + // Invalid state value. + STATE_UNSPECIFIED = 0; + + // Capacity commitment is pending provisioning. Pending capacity commitment + // does not contribute to the project's slot_capacity. + PENDING = 1; + + // Once slots are provisioned, capacity commitment becomes active. + // slot_count is added to the project's slot_capacity. + ACTIVE = 2; + + // Capacity commitment is failed to be activated by the backend. + FAILED = 3; + } + + // Output only. The resource name of the capacity commitment, e.g., + // `projects/myproject/locations/US/capacityCommitments/123` + // The commitment_id must only contain lower case alphanumeric characters or + // dashes. It must start with a letter and must not end + // with a dash. Its maximum length is 64 characters. + string name = 1 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Number of slots in this commitment. + int64 slot_count = 2; + + // Capacity commitment commitment plan. + CommitmentPlan plan = 3; + + // Output only. State of the commitment. + State state = 4 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. The start of the current commitment period. It is applicable + // only for ACTIVE capacity commitments. + google.protobuf.Timestamp commitment_start_time = 9 + [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. The end of the current commitment period. It is applicable + // only for ACTIVE capacity commitments. + google.protobuf.Timestamp commitment_end_time = 5 + [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. For FAILED commitment plan, provides the reason of failure. + google.rpc.Status failure_status = 7 + [(google.api.field_behavior) = OUTPUT_ONLY]; + + // The plan this capacity commitment is converted to after commitment_end_time + // passes. Once the plan is changed, committed period is extended according to + // commitment plan. Only applicable for ANNUAL and TRIAL commitments. + CommitmentPlan renewal_plan = 8; + + // Applicable only for commitments located within one of the BigQuery + // multi-regions (US or EU). + // + // If set to true, this commitment is placed in the organization's + // secondary region which is designated for disaster recovery purposes. + // If false, this commitment is placed in the organization's default region. + bool multi_region_auxiliary = 10; + + // Edition of the capacity commitment. + Edition edition = 12; +} + +// The request for +// [ReservationService.CreateReservation][google.cloud.bigquery.reservation.v1.ReservationService.CreateReservation]. +message CreateReservationRequest { + // Required. Project, location. E.g., + // `projects/myproject/locations/US` + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + child_type: "bigqueryreservation.googleapis.com/Reservation" + } + ]; + + // The reservation ID. It must only contain lower case alphanumeric + // characters or dashes. It must start with a letter and must not end + // with a dash. Its maximum length is 64 characters. + string reservation_id = 2; + + // Definition of the new reservation to create. + Reservation reservation = 3; +} + +// The request for +// [ReservationService.ListReservations][google.cloud.bigquery.reservation.v1.ReservationService.ListReservations]. +message ListReservationsRequest { + // Required. The parent resource name containing project and location, e.g.: + // `projects/myproject/locations/US` + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + child_type: "bigqueryreservation.googleapis.com/Reservation" + } + ]; + + // The maximum number of items to return per page. + int32 page_size = 2; + + // The next_page_token value returned from a previous List request, if any. + string page_token = 3; +} + +// The response for +// [ReservationService.ListReservations][google.cloud.bigquery.reservation.v1.ReservationService.ListReservations]. +message ListReservationsResponse { + // List of reservations visible to the user. + repeated Reservation reservations = 1; + + // Token to retrieve the next page of results, or empty if there are no + // more results in the list. + string next_page_token = 2; +} + +// The request for +// [ReservationService.GetReservation][google.cloud.bigquery.reservation.v1.ReservationService.GetReservation]. +message GetReservationRequest { + // Required. Resource name of the reservation to retrieve. E.g., + // `projects/myproject/locations/US/reservations/team1-prod` + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "bigqueryreservation.googleapis.com/Reservation" + } + ]; +} + +// The request for +// [ReservationService.DeleteReservation][google.cloud.bigquery.reservation.v1.ReservationService.DeleteReservation]. +message DeleteReservationRequest { + // Required. Resource name of the reservation to retrieve. E.g., + // `projects/myproject/locations/US/reservations/team1-prod` + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "bigqueryreservation.googleapis.com/Reservation" + } + ]; +} + +// The request for +// [ReservationService.UpdateReservation][google.cloud.bigquery.reservation.v1.ReservationService.UpdateReservation]. +message UpdateReservationRequest { + // Content of the reservation to update. + Reservation reservation = 1; + + // Standard field mask for the set of fields to be updated. + google.protobuf.FieldMask update_mask = 2; +} + +// The request for +// [ReservationService.CreateCapacityCommitment][google.cloud.bigquery.reservation.v1.ReservationService.CreateCapacityCommitment]. +message CreateCapacityCommitmentRequest { + // Required. Resource name of the parent reservation. E.g., + // `projects/myproject/locations/US` + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + child_type: "bigqueryreservation.googleapis.com/CapacityCommitment" + } + ]; + + // Content of the capacity commitment to create. + CapacityCommitment capacity_commitment = 2; + + // If true, fail the request if another project in the organization has a + // capacity commitment. + bool enforce_single_admin_project_per_org = 4; + + // 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 dashes. + // The first and last character cannot be a dash. Max length is 64 characters. + // NOTE: this ID won't be kept if the capacity commitment is split or merged. + string capacity_commitment_id = 5; +} + +// The request for +// [ReservationService.ListCapacityCommitments][google.cloud.bigquery.reservation.v1.ReservationService.ListCapacityCommitments]. +message ListCapacityCommitmentsRequest { + // Required. Resource name of the parent reservation. E.g., + // `projects/myproject/locations/US` + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + child_type: "bigqueryreservation.googleapis.com/CapacityCommitment" + } + ]; + + // The maximum number of items to return. + int32 page_size = 2; + + // The next_page_token value returned from a previous List request, if any. + string page_token = 3; +} + +// The response for +// [ReservationService.ListCapacityCommitments][google.cloud.bigquery.reservation.v1.ReservationService.ListCapacityCommitments]. +message ListCapacityCommitmentsResponse { + // List of capacity commitments visible to the user. + repeated CapacityCommitment capacity_commitments = 1; + + // Token to retrieve the next page of results, or empty if there are no + // more results in the list. + string next_page_token = 2; +} + +// The request for +// [ReservationService.GetCapacityCommitment][google.cloud.bigquery.reservation.v1.ReservationService.GetCapacityCommitment]. +message GetCapacityCommitmentRequest { + // Required. Resource name of the capacity commitment to retrieve. E.g., + // `projects/myproject/locations/US/capacityCommitments/123` + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "bigqueryreservation.googleapis.com/CapacityCommitment" + } + ]; +} + +// The request for +// [ReservationService.DeleteCapacityCommitment][google.cloud.bigquery.reservation.v1.ReservationService.DeleteCapacityCommitment]. +message DeleteCapacityCommitmentRequest { + // Required. Resource name of the capacity commitment to delete. E.g., + // `projects/myproject/locations/US/capacityCommitments/123` + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "bigqueryreservation.googleapis.com/CapacityCommitment" + } + ]; + + // 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. + bool force = 3; +} + +// The request for +// [ReservationService.UpdateCapacityCommitment][google.cloud.bigquery.reservation.v1.ReservationService.UpdateCapacityCommitment]. +message UpdateCapacityCommitmentRequest { + // Content of the capacity commitment to update. + CapacityCommitment capacity_commitment = 1; + + // Standard field mask for the set of fields to be updated. + google.protobuf.FieldMask update_mask = 2; +} + +// The request for +// [ReservationService.SplitCapacityCommitment][google.cloud.bigquery.reservation.v1.ReservationService.SplitCapacityCommitment]. +message SplitCapacityCommitmentRequest { + // Required. The resource name e.g.,: + // `projects/myproject/locations/US/capacityCommitments/123` + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "bigqueryreservation.googleapis.com/CapacityCommitment" + } + ]; + + // Number of slots in the capacity commitment after the split. + int64 slot_count = 2; +} + +// The response for +// [ReservationService.SplitCapacityCommitment][google.cloud.bigquery.reservation.v1.ReservationService.SplitCapacityCommitment]. +message SplitCapacityCommitmentResponse { + // First capacity commitment, result of a split. + CapacityCommitment first = 1; + + // Second capacity commitment, result of a split. + CapacityCommitment second = 2; +} + +// The request for +// [ReservationService.MergeCapacityCommitments][google.cloud.bigquery.reservation.v1.ReservationService.MergeCapacityCommitments]. +message MergeCapacityCommitmentsRequest { + // Parent resource that identifies admin project and location e.g., + // `projects/myproject/locations/us` + string parent = 1 [(google.api.resource_reference) = { + child_type: "bigqueryreservation.googleapis.com/CapacityCommitment" + }]; + + // 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 + repeated string capacity_commitment_ids = 2; +} + +// An assignment allows a project to submit jobs +// of a certain type using slots from the specified reservation. +message Assignment { + option (google.api.resource) = { + type: "bigqueryreservation.googleapis.com/Assignment" + pattern: "projects/{project}/locations/{location}/reservations/{reservation}/assignments/{assignment}" + }; + + // Types of job, which could be specified when using the reservation. + enum JobType { + // Invalid type. Requests with this value will be rejected with + // error code `google.rpc.Code.INVALID_ARGUMENT`. + JOB_TYPE_UNSPECIFIED = 0; + + // Pipeline (load/export) jobs from the project will use the reservation. + PIPELINE = 1; + + // Query jobs from the project will use the reservation. + QUERY = 2; + + // BigQuery ML jobs that use services external to BigQuery for model + // training. These jobs will not utilize idle slots from other reservations. + ML_EXTERNAL = 3; + + // Background jobs that BigQuery runs for the customers in the background. + BACKGROUND = 4; + } + + // Assignment will remain in PENDING state if no active capacity commitment is + // present. It will become ACTIVE when some capacity commitment becomes + // active. + enum State { + // Invalid state value. + STATE_UNSPECIFIED = 0; + + // Queries from assignee will be executed as on-demand, if related + // assignment is pending. + PENDING = 1; + + // Assignment is ready. + ACTIVE = 2; + } + + // Output only. Name of the resource. E.g.: + // `projects/myproject/locations/US/reservations/team1-prod/assignments/123`. + // The assignment_id must only contain lower case alphanumeric characters or + // dashes and the max length is 64 characters. + string name = 1 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // The resource which will use the reservation. E.g. + // `projects/myproject`, `folders/123`, or `organizations/456`. + string assignee = 4; + + // Which type of jobs will use the reservation. + JobType job_type = 3; + + // Output only. State of the assignment. + State state = 6 [(google.api.field_behavior) = OUTPUT_ONLY]; +} + +// The request for +// [ReservationService.CreateAssignment][google.cloud.bigquery.reservation.v1.ReservationService.CreateAssignment]. +// Note: "bigquery.reservationAssignments.create" permission is required on the +// related assignee. +message CreateAssignmentRequest { + // Required. The parent resource name of the assignment + // E.g. `projects/myproject/locations/US/reservations/team1-prod` + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + child_type: "bigqueryreservation.googleapis.com/Assignment" + } + ]; + + // Assignment resource to create. + Assignment assignment = 2; + + // 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 dashes. + // Max length is 64 characters. + string assignment_id = 4; +} + +// The request for +// [ReservationService.ListAssignments][google.cloud.bigquery.reservation.v1.ReservationService.ListAssignments]. +message ListAssignmentsRequest { + // Required. The parent resource name e.g.: + // + // `projects/myproject/locations/US/reservations/team1-prod` + // + // Or: + // + // `projects/myproject/locations/US/reservations/-` + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + child_type: "bigqueryreservation.googleapis.com/Assignment" + } + ]; + + // The maximum number of items to return per page. + int32 page_size = 2; + + // The next_page_token value returned from a previous List request, if any. + string page_token = 3; +} + +// The response for +// [ReservationService.ListAssignments][google.cloud.bigquery.reservation.v1.ReservationService.ListAssignments]. +message ListAssignmentsResponse { + // List of assignments visible to the user. + repeated Assignment assignments = 1; + + // Token to retrieve the next page of results, or empty if there are no + // more results in the list. + string next_page_token = 2; +} + +// The request for +// [ReservationService.DeleteAssignment][google.cloud.bigquery.reservation.v1.ReservationService.DeleteAssignment]. +// Note: "bigquery.reservationAssignments.delete" permission is required on the +// related assignee. +message DeleteAssignmentRequest { + // Required. Name of the resource, e.g. + // `projects/myproject/locations/US/reservations/team1-prod/assignments/123` + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "bigqueryreservation.googleapis.com/Assignment" + } + ]; +} + +// The request for +// [ReservationService.SearchAssignments][google.cloud.bigquery.reservation.v1.ReservationService.SearchAssignments]. +// Note: "bigquery.reservationAssignments.search" permission is required on the +// related assignee. +message SearchAssignmentsRequest { + // Required. The resource name of the admin project(containing project and + // location), e.g.: + // `projects/myproject/locations/US`. + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "locations.googleapis.com/Location" + } + ]; + + // Please specify resource name as assignee in the query. + // + // Examples: + // + // * `assignee=projects/myproject` + // * `assignee=folders/123` + // * `assignee=organizations/456` + string query = 2; + + // The maximum number of items to return per page. + int32 page_size = 3; + + // The next_page_token value returned from a previous List request, if any. + string page_token = 4; +} + +// The request for +// [ReservationService.SearchAllAssignments][google.cloud.bigquery.reservation.v1.ReservationService.SearchAllAssignments]. +// Note: "bigquery.reservationAssignments.search" permission is required on the +// related assignee. +message SearchAllAssignmentsRequest { + // Required. The resource name with location (project name could be the + // wildcard '-'), e.g.: + // `projects/-/locations/US`. + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "locations.googleapis.com/Location" + } + ]; + + // Please specify resource name as assignee in the query. + // + // Examples: + // + // * `assignee=projects/myproject` + // * `assignee=folders/123` + // * `assignee=organizations/456` + string query = 2; + + // The maximum number of items to return per page. + int32 page_size = 3; + + // The next_page_token value returned from a previous List request, if any. + string page_token = 4; +} + +// The response for +// [ReservationService.SearchAssignments][google.cloud.bigquery.reservation.v1.ReservationService.SearchAssignments]. +message SearchAssignmentsResponse { + // List of assignments visible to the user. + repeated Assignment assignments = 1; + + // Token to retrieve the next page of results, or empty if there are no + // more results in the list. + string next_page_token = 2; +} + +// The response for +// [ReservationService.SearchAllAssignments][google.cloud.bigquery.reservation.v1.ReservationService.SearchAllAssignments]. +message SearchAllAssignmentsResponse { + // List of assignments visible to the user. + repeated Assignment assignments = 1; + + // Token to retrieve the next page of results, or empty if there are no + // more results in the list. + string next_page_token = 2; +} + +// The request for +// [ReservationService.MoveAssignment][google.cloud.bigquery.reservation.v1.ReservationService.MoveAssignment]. +// +// **Note**: "bigquery.reservationAssignments.create" permission is required on +// the destination_id. +// +// **Note**: "bigquery.reservationAssignments.create" and +// "bigquery.reservationAssignments.delete" permission are required on the +// related assignee. +message MoveAssignmentRequest { + // Required. The resource name of the assignment, + // e.g. + // `projects/myproject/locations/US/reservations/team1-prod/assignments/123` + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "bigqueryreservation.googleapis.com/Assignment" + } + ]; + + // The new reservation ID, e.g.: + // `projects/myotherproject/locations/US/reservations/team2-prod` + string destination_id = 3 [(google.api.resource_reference) = { + child_type: "bigqueryreservation.googleapis.com/Assignment" + }]; + + // The optional assignment ID. A new assignment name is generated if this + // field is empty. + // + // This field can contain only lowercase alphanumeric characters or dashes. + // Max length is 64 characters. + string assignment_id = 5; +} + +// The request for +// [ReservationService.UpdateAssignment][google.cloud.bigquery.reservation.v1.ReservationService.UpdateAssignment]. +message UpdateAssignmentRequest { + // Content of the assignment to update. + Assignment assignment = 1; + + // Standard field mask for the set of fields to be updated. + google.protobuf.FieldMask update_mask = 2; +} + +// Fully qualified reference to BigQuery table. +// Internally stored as google.cloud.bi.v1.BqTableReference. +message TableReference { + // The assigned project ID of the project. + string project_id = 1; + + // The ID of the dataset in the above project. + string dataset_id = 2; + + // The ID of the table in the above dataset. + string table_id = 3; +} + +// Represents a BI Reservation. +message BiReservation { + option (google.api.resource) = { + type: "bigqueryreservation.googleapis.com/BiReservation" + pattern: "projects/{project}/locations/{location}/biReservation" + }; + + // The resource name of the singleton BI reservation. + // Reservation names have the form + // `projects/{project_id}/locations/{location_id}/biReservation`. + string name = 1; + + // Output only. The last update timestamp of a reservation. + google.protobuf.Timestamp update_time = 3 + [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Size of a reservation, in bytes. + int64 size = 4; + + // Preferred tables to use BI capacity for. + repeated TableReference preferred_tables = 5; +} + +// A request to get a singleton BI reservation. +message GetBiReservationRequest { + // Required. Name of the requested reservation, for example: + // `projects/{project_id}/locations/{location_id}/biReservation` + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "bigqueryreservation.googleapis.com/BiReservation" + } + ]; +} + +// A request to update a BI reservation. +message UpdateBiReservationRequest { + // A reservation to update. + BiReservation bi_reservation = 1; + + // A list of fields to be updated in this request. + google.protobuf.FieldMask update_mask = 2; +} + +// The type of editions. +// Different features and behaviors are provided to different editions +// Capacity commitments and reservations are linked to editions. +enum Edition { + // Default value, which will be treated as ENTERPRISE. + EDITION_UNSPECIFIED = 0; + + // Standard edition. + STANDARD = 1; + + // Enterprise edition. + ENTERPRISE = 2; + + // Enterprise plus edition. + ENTERPRISE_PLUS = 3; +} diff --git a/owl-bot-staging/google-cloud-bigquery-reservation/v1/samples/generated/v1/reservation_service.create_assignment.js b/owl-bot-staging/google-cloud-bigquery-reservation/v1/samples/generated/v1/reservation_service.create_assignment.js new file mode 100644 index 00000000000..3f46c604c1e --- /dev/null +++ b/owl-bot-staging/google-cloud-bigquery-reservation/v1/samples/generated/v1/reservation_service.create_assignment.js @@ -0,0 +1,73 @@ +// Copyright 2023 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 +// +// https://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. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(parent) { + // [START bigqueryreservation_v1_generated_ReservationService_CreateAssignment_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * 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 dashes. + * 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 callCreateAssignment() { + // Construct request + const request = { + parent, + }; + + // Run request + const response = await reservationClient.createAssignment(request); + console.log(response); + } + + callCreateAssignment(); + // [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/owl-bot-staging/google-cloud-bigquery-reservation/v1/samples/generated/v1/reservation_service.create_capacity_commitment.js b/owl-bot-staging/google-cloud-bigquery-reservation/v1/samples/generated/v1/reservation_service.create_capacity_commitment.js new file mode 100644 index 00000000000..8a6424219ed --- /dev/null +++ b/owl-bot-staging/google-cloud-bigquery-reservation/v1/samples/generated/v1/reservation_service.create_capacity_commitment.js @@ -0,0 +1,79 @@ +// Copyright 2023 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 +// +// https://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. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(parent) { + // [START bigqueryreservation_v1_generated_ReservationService_CreateCapacityCommitment_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * 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 dashes. + * The first and last character cannot be a 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 callCreateCapacityCommitment() { + // Construct request + const request = { + parent, + }; + + // Run request + const response = await reservationClient.createCapacityCommitment(request); + console.log(response); + } + + callCreateCapacityCommitment(); + // [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/owl-bot-staging/google-cloud-bigquery-reservation/v1/samples/generated/v1/reservation_service.create_reservation.js b/owl-bot-staging/google-cloud-bigquery-reservation/v1/samples/generated/v1/reservation_service.create_reservation.js new file mode 100644 index 00000000000..53b7e9c629b --- /dev/null +++ b/owl-bot-staging/google-cloud-bigquery-reservation/v1/samples/generated/v1/reservation_service.create_reservation.js @@ -0,0 +1,72 @@ +// Copyright 2023 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 +// +// https://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. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(parent) { + // [START bigqueryreservation_v1_generated_ReservationService_CreateReservation_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. Project, location. E.g., + * `projects/myproject/locations/US` + */ + // const parent = 'abc123' + /** + * The reservation ID. It must only contain lower case alphanumeric + * characters or dashes. It must start with a letter and must not end + * with a dash. Its maximum 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 callCreateReservation() { + // Construct request + const request = { + parent, + }; + + // Run request + const response = await reservationClient.createReservation(request); + console.log(response); + } + + callCreateReservation(); + // [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/owl-bot-staging/google-cloud-bigquery-reservation/v1/samples/generated/v1/reservation_service.delete_assignment.js b/owl-bot-staging/google-cloud-bigquery-reservation/v1/samples/generated/v1/reservation_service.delete_assignment.js new file mode 100644 index 00000000000..4b901d7f37b --- /dev/null +++ b/owl-bot-staging/google-cloud-bigquery-reservation/v1/samples/generated/v1/reservation_service.delete_assignment.js @@ -0,0 +1,62 @@ +// Copyright 2023 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 +// +// https://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. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(name) { + // [START bigqueryreservation_v1_generated_ReservationService_DeleteAssignment_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * 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 callDeleteAssignment() { + // Construct request + const request = { + name, + }; + + // Run request + const response = await reservationClient.deleteAssignment(request); + console.log(response); + } + + callDeleteAssignment(); + // [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/owl-bot-staging/google-cloud-bigquery-reservation/v1/samples/generated/v1/reservation_service.delete_capacity_commitment.js b/owl-bot-staging/google-cloud-bigquery-reservation/v1/samples/generated/v1/reservation_service.delete_capacity_commitment.js new file mode 100644 index 00000000000..e3ed916d05e --- /dev/null +++ b/owl-bot-staging/google-cloud-bigquery-reservation/v1/samples/generated/v1/reservation_service.delete_capacity_commitment.js @@ -0,0 +1,68 @@ +// Copyright 2023 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 +// +// https://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. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(name) { + // [START bigqueryreservation_v1_generated_ReservationService_DeleteCapacityCommitment_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * 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 callDeleteCapacityCommitment() { + // Construct request + const request = { + name, + }; + + // Run request + const response = await reservationClient.deleteCapacityCommitment(request); + console.log(response); + } + + callDeleteCapacityCommitment(); + // [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/owl-bot-staging/google-cloud-bigquery-reservation/v1/samples/generated/v1/reservation_service.delete_reservation.js b/owl-bot-staging/google-cloud-bigquery-reservation/v1/samples/generated/v1/reservation_service.delete_reservation.js new file mode 100644 index 00000000000..b43b3fb56b3 --- /dev/null +++ b/owl-bot-staging/google-cloud-bigquery-reservation/v1/samples/generated/v1/reservation_service.delete_reservation.js @@ -0,0 +1,62 @@ +// Copyright 2023 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 +// +// https://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. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(name) { + // [START bigqueryreservation_v1_generated_ReservationService_DeleteReservation_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * 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 callDeleteReservation() { + // Construct request + const request = { + name, + }; + + // Run request + const response = await reservationClient.deleteReservation(request); + console.log(response); + } + + callDeleteReservation(); + // [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/owl-bot-staging/google-cloud-bigquery-reservation/v1/samples/generated/v1/reservation_service.get_bi_reservation.js b/owl-bot-staging/google-cloud-bigquery-reservation/v1/samples/generated/v1/reservation_service.get_bi_reservation.js new file mode 100644 index 00000000000..cd07377f8e0 --- /dev/null +++ b/owl-bot-staging/google-cloud-bigquery-reservation/v1/samples/generated/v1/reservation_service.get_bi_reservation.js @@ -0,0 +1,62 @@ +// Copyright 2023 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 +// +// https://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. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(name) { + // [START bigqueryreservation_v1_generated_ReservationService_GetBiReservation_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * 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 callGetBiReservation() { + // Construct request + const request = { + name, + }; + + // Run request + const response = await reservationClient.getBiReservation(request); + console.log(response); + } + + callGetBiReservation(); + // [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/owl-bot-staging/google-cloud-bigquery-reservation/v1/samples/generated/v1/reservation_service.get_capacity_commitment.js b/owl-bot-staging/google-cloud-bigquery-reservation/v1/samples/generated/v1/reservation_service.get_capacity_commitment.js new file mode 100644 index 00000000000..644a274ac6f --- /dev/null +++ b/owl-bot-staging/google-cloud-bigquery-reservation/v1/samples/generated/v1/reservation_service.get_capacity_commitment.js @@ -0,0 +1,62 @@ +// Copyright 2023 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 +// +// https://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. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(name) { + // [START bigqueryreservation_v1_generated_ReservationService_GetCapacityCommitment_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * 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 callGetCapacityCommitment() { + // Construct request + const request = { + name, + }; + + // Run request + const response = await reservationClient.getCapacityCommitment(request); + console.log(response); + } + + callGetCapacityCommitment(); + // [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/owl-bot-staging/google-cloud-bigquery-reservation/v1/samples/generated/v1/reservation_service.get_reservation.js b/owl-bot-staging/google-cloud-bigquery-reservation/v1/samples/generated/v1/reservation_service.get_reservation.js new file mode 100644 index 00000000000..527b9d3e06e --- /dev/null +++ b/owl-bot-staging/google-cloud-bigquery-reservation/v1/samples/generated/v1/reservation_service.get_reservation.js @@ -0,0 +1,62 @@ +// Copyright 2023 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 +// +// https://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. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(name) { + // [START bigqueryreservation_v1_generated_ReservationService_GetReservation_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * 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 callGetReservation() { + // Construct request + const request = { + name, + }; + + // Run request + const response = await reservationClient.getReservation(request); + console.log(response); + } + + callGetReservation(); + // [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/owl-bot-staging/google-cloud-bigquery-reservation/v1/samples/generated/v1/reservation_service.list_assignments.js b/owl-bot-staging/google-cloud-bigquery-reservation/v1/samples/generated/v1/reservation_service.list_assignments.js new file mode 100644 index 00000000000..a332fe1191d --- /dev/null +++ b/owl-bot-staging/google-cloud-bigquery-reservation/v1/samples/generated/v1/reservation_service.list_assignments.js @@ -0,0 +1,74 @@ +// Copyright 2023 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 +// +// https://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. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(parent) { + // [START bigqueryreservation_v1_generated_ReservationService_ListAssignments_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * 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 callListAssignments() { + // Construct request + const request = { + parent, + }; + + // Run request + const iterable = await reservationClient.listAssignmentsAsync(request); + for await (const response of iterable) { + console.log(response); + } + } + + callListAssignments(); + // [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/owl-bot-staging/google-cloud-bigquery-reservation/v1/samples/generated/v1/reservation_service.list_capacity_commitments.js b/owl-bot-staging/google-cloud-bigquery-reservation/v1/samples/generated/v1/reservation_service.list_capacity_commitments.js new file mode 100644 index 00000000000..5b7b802b95c --- /dev/null +++ b/owl-bot-staging/google-cloud-bigquery-reservation/v1/samples/generated/v1/reservation_service.list_capacity_commitments.js @@ -0,0 +1,72 @@ +// Copyright 2023 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 +// +// https://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. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(parent) { + // [START bigqueryreservation_v1_generated_ReservationService_ListCapacityCommitments_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * 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 callListCapacityCommitments() { + // Construct request + const request = { + parent, + }; + + // Run request + const iterable = await reservationClient.listCapacityCommitmentsAsync(request); + for await (const response of iterable) { + console.log(response); + } + } + + callListCapacityCommitments(); + // [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/owl-bot-staging/google-cloud-bigquery-reservation/v1/samples/generated/v1/reservation_service.list_reservations.js b/owl-bot-staging/google-cloud-bigquery-reservation/v1/samples/generated/v1/reservation_service.list_reservations.js new file mode 100644 index 00000000000..be6c006fdc1 --- /dev/null +++ b/owl-bot-staging/google-cloud-bigquery-reservation/v1/samples/generated/v1/reservation_service.list_reservations.js @@ -0,0 +1,72 @@ +// Copyright 2023 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 +// +// https://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. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(parent) { + // [START bigqueryreservation_v1_generated_ReservationService_ListReservations_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * 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 callListReservations() { + // Construct request + const request = { + parent, + }; + + // Run request + const iterable = await reservationClient.listReservationsAsync(request); + for await (const response of iterable) { + console.log(response); + } + } + + callListReservations(); + // [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/owl-bot-staging/google-cloud-bigquery-reservation/v1/samples/generated/v1/reservation_service.merge_capacity_commitments.js b/owl-bot-staging/google-cloud-bigquery-reservation/v1/samples/generated/v1/reservation_service.merge_capacity_commitments.js new file mode 100644 index 00000000000..b3a9ae0eae3 --- /dev/null +++ b/owl-bot-staging/google-cloud-bigquery-reservation/v1/samples/generated/v1/reservation_service.merge_capacity_commitments.js @@ -0,0 +1,69 @@ +// Copyright 2023 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 +// +// https://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. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main() { + // [START bigqueryreservation_v1_generated_ReservationService_MergeCapacityCommitments_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * 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 callMergeCapacityCommitments() { + // Construct request + const request = { + }; + + // Run request + const response = await reservationClient.mergeCapacityCommitments(request); + console.log(response); + } + + callMergeCapacityCommitments(); + // [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/owl-bot-staging/google-cloud-bigquery-reservation/v1/samples/generated/v1/reservation_service.move_assignment.js b/owl-bot-staging/google-cloud-bigquery-reservation/v1/samples/generated/v1/reservation_service.move_assignment.js new file mode 100644 index 00000000000..e276e921492 --- /dev/null +++ b/owl-bot-staging/google-cloud-bigquery-reservation/v1/samples/generated/v1/reservation_service.move_assignment.js @@ -0,0 +1,75 @@ +// Copyright 2023 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 +// +// https://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. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(name) { + // [START bigqueryreservation_v1_generated_ReservationService_MoveAssignment_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * 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' + /** + * The optional assignment ID. A new assignment name is generated if this + * field is empty. + * This field can contain only lowercase alphanumeric characters or dashes. + * 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 callMoveAssignment() { + // Construct request + const request = { + name, + }; + + // Run request + const response = await reservationClient.moveAssignment(request); + console.log(response); + } + + callMoveAssignment(); + // [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/owl-bot-staging/google-cloud-bigquery-reservation/v1/samples/generated/v1/reservation_service.search_all_assignments.js b/owl-bot-staging/google-cloud-bigquery-reservation/v1/samples/generated/v1/reservation_service.search_all_assignments.js new file mode 100644 index 00000000000..167f612c31e --- /dev/null +++ b/owl-bot-staging/google-cloud-bigquery-reservation/v1/samples/generated/v1/reservation_service.search_all_assignments.js @@ -0,0 +1,81 @@ +// Copyright 2023 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 +// +// https://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. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(parent) { + // [START bigqueryreservation_v1_generated_ReservationService_SearchAllAssignments_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * 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 callSearchAllAssignments() { + // Construct request + const request = { + parent, + }; + + // Run request + const iterable = await reservationClient.searchAllAssignmentsAsync(request); + for await (const response of iterable) { + console.log(response); + } + } + + callSearchAllAssignments(); + // [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/owl-bot-staging/google-cloud-bigquery-reservation/v1/samples/generated/v1/reservation_service.search_assignments.js b/owl-bot-staging/google-cloud-bigquery-reservation/v1/samples/generated/v1/reservation_service.search_assignments.js new file mode 100644 index 00000000000..69d2d047e6d --- /dev/null +++ b/owl-bot-staging/google-cloud-bigquery-reservation/v1/samples/generated/v1/reservation_service.search_assignments.js @@ -0,0 +1,81 @@ +// Copyright 2023 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 +// +// https://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. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(parent) { + // [START bigqueryreservation_v1_generated_ReservationService_SearchAssignments_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * 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 callSearchAssignments() { + // Construct request + const request = { + parent, + }; + + // Run request + const iterable = await reservationClient.searchAssignmentsAsync(request); + for await (const response of iterable) { + console.log(response); + } + } + + callSearchAssignments(); + // [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/owl-bot-staging/google-cloud-bigquery-reservation/v1/samples/generated/v1/reservation_service.split_capacity_commitment.js b/owl-bot-staging/google-cloud-bigquery-reservation/v1/samples/generated/v1/reservation_service.split_capacity_commitment.js new file mode 100644 index 00000000000..269e4fb07ed --- /dev/null +++ b/owl-bot-staging/google-cloud-bigquery-reservation/v1/samples/generated/v1/reservation_service.split_capacity_commitment.js @@ -0,0 +1,66 @@ +// Copyright 2023 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 +// +// https://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. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(name) { + // [START bigqueryreservation_v1_generated_ReservationService_SplitCapacityCommitment_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * 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 callSplitCapacityCommitment() { + // Construct request + const request = { + name, + }; + + // Run request + const response = await reservationClient.splitCapacityCommitment(request); + console.log(response); + } + + callSplitCapacityCommitment(); + // [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/owl-bot-staging/google-cloud-bigquery-reservation/v1/samples/generated/v1/reservation_service.update_assignment.js b/owl-bot-staging/google-cloud-bigquery-reservation/v1/samples/generated/v1/reservation_service.update_assignment.js new file mode 100644 index 00000000000..06877f99cd2 --- /dev/null +++ b/owl-bot-staging/google-cloud-bigquery-reservation/v1/samples/generated/v1/reservation_service.update_assignment.js @@ -0,0 +1,64 @@ +// Copyright 2023 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 +// +// https://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. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main() { + // [START bigqueryreservation_v1_generated_ReservationService_UpdateAssignment_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Content of the assignment to update. + */ + // const assignment = {} + /** + * 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 callUpdateAssignment() { + // Construct request + const request = { + }; + + // Run request + const response = await reservationClient.updateAssignment(request); + console.log(response); + } + + callUpdateAssignment(); + // [END bigqueryreservation_v1_generated_ReservationService_UpdateAssignment_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-bigquery-reservation/v1/samples/generated/v1/reservation_service.update_bi_reservation.js b/owl-bot-staging/google-cloud-bigquery-reservation/v1/samples/generated/v1/reservation_service.update_bi_reservation.js new file mode 100644 index 00000000000..1de0e95ae13 --- /dev/null +++ b/owl-bot-staging/google-cloud-bigquery-reservation/v1/samples/generated/v1/reservation_service.update_bi_reservation.js @@ -0,0 +1,64 @@ +// Copyright 2023 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 +// +// https://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. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main() { + // [START bigqueryreservation_v1_generated_ReservationService_UpdateBiReservation_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * 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 callUpdateBiReservation() { + // Construct request + const request = { + }; + + // Run request + const response = await reservationClient.updateBiReservation(request); + console.log(response); + } + + callUpdateBiReservation(); + // [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/owl-bot-staging/google-cloud-bigquery-reservation/v1/samples/generated/v1/reservation_service.update_capacity_commitment.js b/owl-bot-staging/google-cloud-bigquery-reservation/v1/samples/generated/v1/reservation_service.update_capacity_commitment.js new file mode 100644 index 00000000000..acc72de49b3 --- /dev/null +++ b/owl-bot-staging/google-cloud-bigquery-reservation/v1/samples/generated/v1/reservation_service.update_capacity_commitment.js @@ -0,0 +1,64 @@ +// Copyright 2023 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 +// +// https://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. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main() { + // [START bigqueryreservation_v1_generated_ReservationService_UpdateCapacityCommitment_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * 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 callUpdateCapacityCommitment() { + // Construct request + const request = { + }; + + // Run request + const response = await reservationClient.updateCapacityCommitment(request); + console.log(response); + } + + callUpdateCapacityCommitment(); + // [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/owl-bot-staging/google-cloud-bigquery-reservation/v1/samples/generated/v1/reservation_service.update_reservation.js b/owl-bot-staging/google-cloud-bigquery-reservation/v1/samples/generated/v1/reservation_service.update_reservation.js new file mode 100644 index 00000000000..189b38f67f0 --- /dev/null +++ b/owl-bot-staging/google-cloud-bigquery-reservation/v1/samples/generated/v1/reservation_service.update_reservation.js @@ -0,0 +1,64 @@ +// Copyright 2023 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 +// +// https://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. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main() { + // [START bigqueryreservation_v1_generated_ReservationService_UpdateReservation_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * 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 callUpdateReservation() { + // Construct request + const request = { + }; + + // Run request + const response = await reservationClient.updateReservation(request); + console.log(response); + } + + callUpdateReservation(); + // [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/owl-bot-staging/google-cloud-bigquery-reservation/v1/samples/generated/v1/snippet_metadata.google.cloud.bigquery.reservation.v1.json b/owl-bot-staging/google-cloud-bigquery-reservation/v1/samples/generated/v1/snippet_metadata.google.cloud.bigquery.reservation.v1.json new file mode 100644 index 00000000000..e1e38fbfb98 --- /dev/null +++ b/owl-bot-staging/google-cloud-bigquery-reservation/v1/samples/generated/v1/snippet_metadata.google.cloud.bigquery.reservation.v1.json @@ -0,0 +1,967 @@ +{ + "clientLibrary": { + "name": "nodejs-reservation", + "version": "0.1.0", + "language": "TYPESCRIPT", + "apis": [ + { + "id": "google.cloud.bigquery.reservation.v1", + "version": "v1" + } + ] + }, + "snippets": [ + { + "regionTag": "bigqueryreservation_v1_generated_ReservationService_CreateReservation_async", + "title": "ReservationService createReservation Sample", + "origin": "API_DEFINITION", + "description": " Creates a new reservation resource.", + "canonical": true, + "file": "reservation_service.create_reservation.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 64, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "CreateReservation", + "fullName": "google.cloud.bigquery.reservation.v1.ReservationService.CreateReservation", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "reservation_id", + "type": "TYPE_STRING" + }, + { + "name": "reservation", + "type": ".google.cloud.bigquery.reservation.v1.Reservation" + } + ], + "resultType": ".google.cloud.bigquery.reservation.v1.Reservation", + "client": { + "shortName": "ReservationServiceClient", + "fullName": "google.cloud.bigquery.reservation.v1.ReservationServiceClient" + }, + "method": { + "shortName": "CreateReservation", + "fullName": "google.cloud.bigquery.reservation.v1.ReservationService.CreateReservation", + "service": { + "shortName": "ReservationService", + "fullName": "google.cloud.bigquery.reservation.v1.ReservationService" + } + } + } + }, + { + "regionTag": "bigqueryreservation_v1_generated_ReservationService_ListReservations_async", + "title": "ReservationService listReservations Sample", + "origin": "API_DEFINITION", + "description": " Lists all the reservations for the project in the specified location.", + "canonical": true, + "file": "reservation_service.list_reservations.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 64, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "ListReservations", + "fullName": "google.cloud.bigquery.reservation.v1.ReservationService.ListReservations", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "page_size", + "type": "TYPE_INT32" + }, + { + "name": "page_token", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.bigquery.reservation.v1.ListReservationsResponse", + "client": { + "shortName": "ReservationServiceClient", + "fullName": "google.cloud.bigquery.reservation.v1.ReservationServiceClient" + }, + "method": { + "shortName": "ListReservations", + "fullName": "google.cloud.bigquery.reservation.v1.ReservationService.ListReservations", + "service": { + "shortName": "ReservationService", + "fullName": "google.cloud.bigquery.reservation.v1.ReservationService" + } + } + } + }, + { + "regionTag": "bigqueryreservation_v1_generated_ReservationService_GetReservation_async", + "title": "ReservationService getReservation Sample", + "origin": "API_DEFINITION", + "description": " Returns information about the reservation.", + "canonical": true, + "file": "reservation_service.get_reservation.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 54, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "GetReservation", + "fullName": "google.cloud.bigquery.reservation.v1.ReservationService.GetReservation", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.bigquery.reservation.v1.Reservation", + "client": { + "shortName": "ReservationServiceClient", + "fullName": "google.cloud.bigquery.reservation.v1.ReservationServiceClient" + }, + "method": { + "shortName": "GetReservation", + "fullName": "google.cloud.bigquery.reservation.v1.ReservationService.GetReservation", + "service": { + "shortName": "ReservationService", + "fullName": "google.cloud.bigquery.reservation.v1.ReservationService" + } + } + } + }, + { + "regionTag": "bigqueryreservation_v1_generated_ReservationService_DeleteReservation_async", + "title": "ReservationService deleteReservation Sample", + "origin": "API_DEFINITION", + "description": " Deletes a reservation. Returns `google.rpc.Code.FAILED_PRECONDITION` when reservation has assignments.", + "canonical": true, + "file": "reservation_service.delete_reservation.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 54, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "DeleteReservation", + "fullName": "google.cloud.bigquery.reservation.v1.ReservationService.DeleteReservation", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.protobuf.Empty", + "client": { + "shortName": "ReservationServiceClient", + "fullName": "google.cloud.bigquery.reservation.v1.ReservationServiceClient" + }, + "method": { + "shortName": "DeleteReservation", + "fullName": "google.cloud.bigquery.reservation.v1.ReservationService.DeleteReservation", + "service": { + "shortName": "ReservationService", + "fullName": "google.cloud.bigquery.reservation.v1.ReservationService" + } + } + } + }, + { + "regionTag": "bigqueryreservation_v1_generated_ReservationService_UpdateReservation_async", + "title": "ReservationService updateReservation Sample", + "origin": "API_DEFINITION", + "description": " Updates an existing reservation resource.", + "canonical": true, + "file": "reservation_service.update_reservation.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 56, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "UpdateReservation", + "fullName": "google.cloud.bigquery.reservation.v1.ReservationService.UpdateReservation", + "async": true, + "parameters": [ + { + "name": "reservation", + "type": ".google.cloud.bigquery.reservation.v1.Reservation" + }, + { + "name": "update_mask", + "type": ".google.protobuf.FieldMask" + } + ], + "resultType": ".google.cloud.bigquery.reservation.v1.Reservation", + "client": { + "shortName": "ReservationServiceClient", + "fullName": "google.cloud.bigquery.reservation.v1.ReservationServiceClient" + }, + "method": { + "shortName": "UpdateReservation", + "fullName": "google.cloud.bigquery.reservation.v1.ReservationService.UpdateReservation", + "service": { + "shortName": "ReservationService", + "fullName": "google.cloud.bigquery.reservation.v1.ReservationService" + } + } + } + }, + { + "regionTag": "bigqueryreservation_v1_generated_ReservationService_CreateCapacityCommitment_async", + "title": "ReservationService createCapacityCommitment Sample", + "origin": "API_DEFINITION", + "description": " Creates a new capacity commitment resource.", + "canonical": true, + "file": "reservation_service.create_capacity_commitment.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 71, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "CreateCapacityCommitment", + "fullName": "google.cloud.bigquery.reservation.v1.ReservationService.CreateCapacityCommitment", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "capacity_commitment", + "type": ".google.cloud.bigquery.reservation.v1.CapacityCommitment" + }, + { + "name": "enforce_single_admin_project_per_org", + "type": "TYPE_BOOL" + }, + { + "name": "capacity_commitment_id", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.bigquery.reservation.v1.CapacityCommitment", + "client": { + "shortName": "ReservationServiceClient", + "fullName": "google.cloud.bigquery.reservation.v1.ReservationServiceClient" + }, + "method": { + "shortName": "CreateCapacityCommitment", + "fullName": "google.cloud.bigquery.reservation.v1.ReservationService.CreateCapacityCommitment", + "service": { + "shortName": "ReservationService", + "fullName": "google.cloud.bigquery.reservation.v1.ReservationService" + } + } + } + }, + { + "regionTag": "bigqueryreservation_v1_generated_ReservationService_ListCapacityCommitments_async", + "title": "ReservationService listCapacityCommitments Sample", + "origin": "API_DEFINITION", + "description": " Lists all the capacity commitments for the admin project.", + "canonical": true, + "file": "reservation_service.list_capacity_commitments.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 64, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "ListCapacityCommitments", + "fullName": "google.cloud.bigquery.reservation.v1.ReservationService.ListCapacityCommitments", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "page_size", + "type": "TYPE_INT32" + }, + { + "name": "page_token", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.bigquery.reservation.v1.ListCapacityCommitmentsResponse", + "client": { + "shortName": "ReservationServiceClient", + "fullName": "google.cloud.bigquery.reservation.v1.ReservationServiceClient" + }, + "method": { + "shortName": "ListCapacityCommitments", + "fullName": "google.cloud.bigquery.reservation.v1.ReservationService.ListCapacityCommitments", + "service": { + "shortName": "ReservationService", + "fullName": "google.cloud.bigquery.reservation.v1.ReservationService" + } + } + } + }, + { + "regionTag": "bigqueryreservation_v1_generated_ReservationService_GetCapacityCommitment_async", + "title": "ReservationService getCapacityCommitment Sample", + "origin": "API_DEFINITION", + "description": " Returns information about the capacity commitment.", + "canonical": true, + "file": "reservation_service.get_capacity_commitment.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 54, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "GetCapacityCommitment", + "fullName": "google.cloud.bigquery.reservation.v1.ReservationService.GetCapacityCommitment", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.bigquery.reservation.v1.CapacityCommitment", + "client": { + "shortName": "ReservationServiceClient", + "fullName": "google.cloud.bigquery.reservation.v1.ReservationServiceClient" + }, + "method": { + "shortName": "GetCapacityCommitment", + "fullName": "google.cloud.bigquery.reservation.v1.ReservationService.GetCapacityCommitment", + "service": { + "shortName": "ReservationService", + "fullName": "google.cloud.bigquery.reservation.v1.ReservationService" + } + } + } + }, + { + "regionTag": "bigqueryreservation_v1_generated_ReservationService_DeleteCapacityCommitment_async", + "title": "ReservationService deleteCapacityCommitment Sample", + "origin": "API_DEFINITION", + "description": " Deletes a capacity commitment. Attempting to delete capacity commitment before its commitment_end_time will fail with the error code `google.rpc.Code.FAILED_PRECONDITION`.", + "canonical": true, + "file": "reservation_service.delete_capacity_commitment.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 60, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "DeleteCapacityCommitment", + "fullName": "google.cloud.bigquery.reservation.v1.ReservationService.DeleteCapacityCommitment", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + }, + { + "name": "force", + "type": "TYPE_BOOL" + } + ], + "resultType": ".google.protobuf.Empty", + "client": { + "shortName": "ReservationServiceClient", + "fullName": "google.cloud.bigquery.reservation.v1.ReservationServiceClient" + }, + "method": { + "shortName": "DeleteCapacityCommitment", + "fullName": "google.cloud.bigquery.reservation.v1.ReservationService.DeleteCapacityCommitment", + "service": { + "shortName": "ReservationService", + "fullName": "google.cloud.bigquery.reservation.v1.ReservationService" + } + } + } + }, + { + "regionTag": "bigqueryreservation_v1_generated_ReservationService_UpdateCapacityCommitment_async", + "title": "ReservationService updateCapacityCommitment Sample", + "origin": "API_DEFINITION", + "description": " Updates an existing capacity commitment. Only `plan` and `renewal_plan` fields can be updated. Plan can only be changed to a plan of a longer commitment period. Attempting to change to a plan with shorter commitment period will fail with the error code `google.rpc.Code.FAILED_PRECONDITION`.", + "canonical": true, + "file": "reservation_service.update_capacity_commitment.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 56, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "UpdateCapacityCommitment", + "fullName": "google.cloud.bigquery.reservation.v1.ReservationService.UpdateCapacityCommitment", + "async": true, + "parameters": [ + { + "name": "capacity_commitment", + "type": ".google.cloud.bigquery.reservation.v1.CapacityCommitment" + }, + { + "name": "update_mask", + "type": ".google.protobuf.FieldMask" + } + ], + "resultType": ".google.cloud.bigquery.reservation.v1.CapacityCommitment", + "client": { + "shortName": "ReservationServiceClient", + "fullName": "google.cloud.bigquery.reservation.v1.ReservationServiceClient" + }, + "method": { + "shortName": "UpdateCapacityCommitment", + "fullName": "google.cloud.bigquery.reservation.v1.ReservationService.UpdateCapacityCommitment", + "service": { + "shortName": "ReservationService", + "fullName": "google.cloud.bigquery.reservation.v1.ReservationService" + } + } + } + }, + { + "regionTag": "bigqueryreservation_v1_generated_ReservationService_SplitCapacityCommitment_async", + "title": "ReservationService splitCapacityCommitment Sample", + "origin": "API_DEFINITION", + "description": " Splits capacity commitment to two commitments of the same plan and `commitment_end_time`. A common use case is to enable downgrading commitments. For example, in order to downgrade from 10000 slots to 8000, you might split a 10000 capacity commitment into commitments of 2000 and 8000. Then, you delete the first one after the commitment end time passes.", + "canonical": true, + "file": "reservation_service.split_capacity_commitment.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 58, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "SplitCapacityCommitment", + "fullName": "google.cloud.bigquery.reservation.v1.ReservationService.SplitCapacityCommitment", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + }, + { + "name": "slot_count", + "type": "TYPE_INT64" + } + ], + "resultType": ".google.cloud.bigquery.reservation.v1.SplitCapacityCommitmentResponse", + "client": { + "shortName": "ReservationServiceClient", + "fullName": "google.cloud.bigquery.reservation.v1.ReservationServiceClient" + }, + "method": { + "shortName": "SplitCapacityCommitment", + "fullName": "google.cloud.bigquery.reservation.v1.ReservationService.SplitCapacityCommitment", + "service": { + "shortName": "ReservationService", + "fullName": "google.cloud.bigquery.reservation.v1.ReservationService" + } + } + } + }, + { + "regionTag": "bigqueryreservation_v1_generated_ReservationService_MergeCapacityCommitments_async", + "title": "ReservationService mergeCapacityCommitments Sample", + "origin": "API_DEFINITION", + "description": " Merges capacity commitments of the same plan into a single commitment. The resulting capacity commitment has the greater commitment_end_time out of the to-be-merged capacity commitments. Attempting to merge capacity commitments of different plan will fail with the error code `google.rpc.Code.FAILED_PRECONDITION`.", + "canonical": true, + "file": "reservation_service.merge_capacity_commitments.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 61, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "MergeCapacityCommitments", + "fullName": "google.cloud.bigquery.reservation.v1.ReservationService.MergeCapacityCommitments", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "capacity_commitment_ids", + "type": "TYPE_STRING[]" + } + ], + "resultType": ".google.cloud.bigquery.reservation.v1.CapacityCommitment", + "client": { + "shortName": "ReservationServiceClient", + "fullName": "google.cloud.bigquery.reservation.v1.ReservationServiceClient" + }, + "method": { + "shortName": "MergeCapacityCommitments", + "fullName": "google.cloud.bigquery.reservation.v1.ReservationService.MergeCapacityCommitments", + "service": { + "shortName": "ReservationService", + "fullName": "google.cloud.bigquery.reservation.v1.ReservationService" + } + } + } + }, + { + "regionTag": "bigqueryreservation_v1_generated_ReservationService_CreateAssignment_async", + "title": "ReservationService createAssignment Sample", + "origin": "API_DEFINITION", + "description": " Creates an assignment object which allows the given project to submit jobs of a certain type using slots from the specified reservation. Currently a resource (project, folder, organization) can only have one assignment per each (job_type, location) combination, and that reservation will be used for all jobs of the matching type. Different assignments can be created on different levels of the projects, folders or organization hierarchy. During query execution, the assignment is looked up at the project, folder and organization levels in that order. The first assignment found is applied to the query. When creating assignments, it does not matter if other assignments exist at higher levels. Example: * The organization `organizationA` contains two projects, `project1` and `project2`. * Assignments for all three entities (`organizationA`, `project1`, and `project2`) could all be created and mapped to the same or different reservations. \"None\" assignments represent an absence of the assignment. Projects assigned to None use on-demand pricing. To create a \"None\" assignment, use \"none\" as a reservation_id in the parent. Example parent: `projects/myproject/locations/US/reservations/none`. Returns `google.rpc.Code.PERMISSION_DENIED` if user does not have 'bigquery.admin' permissions on the project using the reservation and the project that owns this reservation. Returns `google.rpc.Code.INVALID_ARGUMENT` when location of the assignment does not match location of the reservation.", + "canonical": true, + "file": "reservation_service.create_assignment.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 65, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "CreateAssignment", + "fullName": "google.cloud.bigquery.reservation.v1.ReservationService.CreateAssignment", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "assignment", + "type": ".google.cloud.bigquery.reservation.v1.Assignment" + }, + { + "name": "assignment_id", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.bigquery.reservation.v1.Assignment", + "client": { + "shortName": "ReservationServiceClient", + "fullName": "google.cloud.bigquery.reservation.v1.ReservationServiceClient" + }, + "method": { + "shortName": "CreateAssignment", + "fullName": "google.cloud.bigquery.reservation.v1.ReservationService.CreateAssignment", + "service": { + "shortName": "ReservationService", + "fullName": "google.cloud.bigquery.reservation.v1.ReservationService" + } + } + } + }, + { + "regionTag": "bigqueryreservation_v1_generated_ReservationService_ListAssignments_async", + "title": "ReservationService listAssignments Sample", + "origin": "API_DEFINITION", + "description": " Lists assignments. Only explicitly created assignments will be returned. Example: * Organization `organizationA` contains two projects, `project1` and `project2`. * Reservation `res1` exists and was created previously. * CreateAssignment was used previously to define the following associations between entities and reservations: `` and `` In this example, ListAssignments will just return the above two assignments for reservation `res1`, and no expansion/merge will happen. The wildcard \"-\" can be used for reservations in the request. In that case all assignments belongs to the specified project and location will be listed. **Note** \"-\" cannot be used for projects nor locations.", + "canonical": true, + "file": "reservation_service.list_assignments.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 66, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "ListAssignments", + "fullName": "google.cloud.bigquery.reservation.v1.ReservationService.ListAssignments", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "page_size", + "type": "TYPE_INT32" + }, + { + "name": "page_token", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.bigquery.reservation.v1.ListAssignmentsResponse", + "client": { + "shortName": "ReservationServiceClient", + "fullName": "google.cloud.bigquery.reservation.v1.ReservationServiceClient" + }, + "method": { + "shortName": "ListAssignments", + "fullName": "google.cloud.bigquery.reservation.v1.ReservationService.ListAssignments", + "service": { + "shortName": "ReservationService", + "fullName": "google.cloud.bigquery.reservation.v1.ReservationService" + } + } + } + }, + { + "regionTag": "bigqueryreservation_v1_generated_ReservationService_DeleteAssignment_async", + "title": "ReservationService deleteAssignment Sample", + "origin": "API_DEFINITION", + "description": " Deletes a assignment. No expansion will happen. Example: * Organization `organizationA` contains two projects, `project1` and `project2`. * Reservation `res1` exists and was created previously. * CreateAssignment was used previously to define the following associations between entities and reservations: `` and `` In this example, deletion of the `` assignment won't affect the other assignment ``. After said deletion, queries from `project1` will still use `res1` while queries from `project2` will switch to use on-demand mode.", + "canonical": true, + "file": "reservation_service.delete_assignment.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 54, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "DeleteAssignment", + "fullName": "google.cloud.bigquery.reservation.v1.ReservationService.DeleteAssignment", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.protobuf.Empty", + "client": { + "shortName": "ReservationServiceClient", + "fullName": "google.cloud.bigquery.reservation.v1.ReservationServiceClient" + }, + "method": { + "shortName": "DeleteAssignment", + "fullName": "google.cloud.bigquery.reservation.v1.ReservationService.DeleteAssignment", + "service": { + "shortName": "ReservationService", + "fullName": "google.cloud.bigquery.reservation.v1.ReservationService" + } + } + } + }, + { + "regionTag": "bigqueryreservation_v1_generated_ReservationService_SearchAssignments_async", + "title": "ReservationService searchAssignments Sample", + "origin": "API_DEFINITION", + "description": " Deprecated: Looks up assignments for a specified resource for a particular region. If the request is about a project: 1. Assignments created on the project will be returned if they exist. 2. Otherwise assignments created on the closest ancestor will be returned. 3. Assignments for different JobTypes will all be returned. The same logic applies if the request is about a folder. If the request is about an organization, then assignments created on the organization will be returned (organization doesn't have ancestors). Comparing to ListAssignments, there are some behavior differences: 1. permission on the assignee will be verified in this API. 2. Hierarchy lookup (project->folder->organization) happens in this API. 3. Parent here is `projects/*/locations/*`, instead of `projects/*/locations/*reservations/*`. **Note** \"-\" cannot be used for projects nor locations.", + "canonical": true, + "file": "reservation_service.search_assignments.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 73, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "SearchAssignments", + "fullName": "google.cloud.bigquery.reservation.v1.ReservationService.SearchAssignments", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "query", + "type": "TYPE_STRING" + }, + { + "name": "page_size", + "type": "TYPE_INT32" + }, + { + "name": "page_token", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.bigquery.reservation.v1.SearchAssignmentsResponse", + "client": { + "shortName": "ReservationServiceClient", + "fullName": "google.cloud.bigquery.reservation.v1.ReservationServiceClient" + }, + "method": { + "shortName": "SearchAssignments", + "fullName": "google.cloud.bigquery.reservation.v1.ReservationService.SearchAssignments", + "service": { + "shortName": "ReservationService", + "fullName": "google.cloud.bigquery.reservation.v1.ReservationService" + } + } + } + }, + { + "regionTag": "bigqueryreservation_v1_generated_ReservationService_SearchAllAssignments_async", + "title": "ReservationService searchAllAssignments Sample", + "origin": "API_DEFINITION", + "description": " Looks up assignments for a specified resource for a particular region. If the request is about a project: 1. Assignments created on the project will be returned if they exist. 2. Otherwise assignments created on the closest ancestor will be returned. 3. Assignments for different JobTypes will all be returned. The same logic applies if the request is about a folder. If the request is about an organization, then assignments created on the organization will be returned (organization doesn't have ancestors). Comparing to ListAssignments, there are some behavior differences: 1. permission on the assignee will be verified in this API. 2. Hierarchy lookup (project->folder->organization) happens in this API. 3. Parent here is `projects/*/locations/*`, instead of `projects/*/locations/*reservations/*`.", + "canonical": true, + "file": "reservation_service.search_all_assignments.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 73, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "SearchAllAssignments", + "fullName": "google.cloud.bigquery.reservation.v1.ReservationService.SearchAllAssignments", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "query", + "type": "TYPE_STRING" + }, + { + "name": "page_size", + "type": "TYPE_INT32" + }, + { + "name": "page_token", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.bigquery.reservation.v1.SearchAllAssignmentsResponse", + "client": { + "shortName": "ReservationServiceClient", + "fullName": "google.cloud.bigquery.reservation.v1.ReservationServiceClient" + }, + "method": { + "shortName": "SearchAllAssignments", + "fullName": "google.cloud.bigquery.reservation.v1.ReservationService.SearchAllAssignments", + "service": { + "shortName": "ReservationService", + "fullName": "google.cloud.bigquery.reservation.v1.ReservationService" + } + } + } + }, + { + "regionTag": "bigqueryreservation_v1_generated_ReservationService_MoveAssignment_async", + "title": "ReservationService moveAssignment Sample", + "origin": "API_DEFINITION", + "description": " Moves an assignment under a new reservation. This differs from removing an existing assignment and recreating a new one by providing a transactional change that ensures an assignee always has an associated reservation.", + "canonical": true, + "file": "reservation_service.move_assignment.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 67, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "MoveAssignment", + "fullName": "google.cloud.bigquery.reservation.v1.ReservationService.MoveAssignment", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + }, + { + "name": "destination_id", + "type": "TYPE_STRING" + }, + { + "name": "assignment_id", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.bigquery.reservation.v1.Assignment", + "client": { + "shortName": "ReservationServiceClient", + "fullName": "google.cloud.bigquery.reservation.v1.ReservationServiceClient" + }, + "method": { + "shortName": "MoveAssignment", + "fullName": "google.cloud.bigquery.reservation.v1.ReservationService.MoveAssignment", + "service": { + "shortName": "ReservationService", + "fullName": "google.cloud.bigquery.reservation.v1.ReservationService" + } + } + } + }, + { + "regionTag": "bigqueryreservation_v1_generated_ReservationService_UpdateAssignment_async", + "title": "ReservationService updateAssignment Sample", + "origin": "API_DEFINITION", + "description": " Updates an existing assignment. Only the `priority` field can be updated.", + "canonical": true, + "file": "reservation_service.update_assignment.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 56, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "UpdateAssignment", + "fullName": "google.cloud.bigquery.reservation.v1.ReservationService.UpdateAssignment", + "async": true, + "parameters": [ + { + "name": "assignment", + "type": ".google.cloud.bigquery.reservation.v1.Assignment" + }, + { + "name": "update_mask", + "type": ".google.protobuf.FieldMask" + } + ], + "resultType": ".google.cloud.bigquery.reservation.v1.Assignment", + "client": { + "shortName": "ReservationServiceClient", + "fullName": "google.cloud.bigquery.reservation.v1.ReservationServiceClient" + }, + "method": { + "shortName": "UpdateAssignment", + "fullName": "google.cloud.bigquery.reservation.v1.ReservationService.UpdateAssignment", + "service": { + "shortName": "ReservationService", + "fullName": "google.cloud.bigquery.reservation.v1.ReservationService" + } + } + } + }, + { + "regionTag": "bigqueryreservation_v1_generated_ReservationService_GetBiReservation_async", + "title": "ReservationService getBiReservation Sample", + "origin": "API_DEFINITION", + "description": " Retrieves a BI reservation.", + "canonical": true, + "file": "reservation_service.get_bi_reservation.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 54, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "GetBiReservation", + "fullName": "google.cloud.bigquery.reservation.v1.ReservationService.GetBiReservation", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.bigquery.reservation.v1.BiReservation", + "client": { + "shortName": "ReservationServiceClient", + "fullName": "google.cloud.bigquery.reservation.v1.ReservationServiceClient" + }, + "method": { + "shortName": "GetBiReservation", + "fullName": "google.cloud.bigquery.reservation.v1.ReservationService.GetBiReservation", + "service": { + "shortName": "ReservationService", + "fullName": "google.cloud.bigquery.reservation.v1.ReservationService" + } + } + } + }, + { + "regionTag": "bigqueryreservation_v1_generated_ReservationService_UpdateBiReservation_async", + "title": "ReservationService updateBiReservation Sample", + "origin": "API_DEFINITION", + "description": " Updates a BI reservation. Only fields specified in the `field_mask` are updated. A singleton BI reservation always exists with default size 0. In order to reserve BI capacity it needs to be updated to an amount greater than 0. In order to release BI capacity reservation size must be set to 0.", + "canonical": true, + "file": "reservation_service.update_bi_reservation.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 56, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "UpdateBiReservation", + "fullName": "google.cloud.bigquery.reservation.v1.ReservationService.UpdateBiReservation", + "async": true, + "parameters": [ + { + "name": "bi_reservation", + "type": ".google.cloud.bigquery.reservation.v1.BiReservation" + }, + { + "name": "update_mask", + "type": ".google.protobuf.FieldMask" + } + ], + "resultType": ".google.cloud.bigquery.reservation.v1.BiReservation", + "client": { + "shortName": "ReservationServiceClient", + "fullName": "google.cloud.bigquery.reservation.v1.ReservationServiceClient" + }, + "method": { + "shortName": "UpdateBiReservation", + "fullName": "google.cloud.bigquery.reservation.v1.ReservationService.UpdateBiReservation", + "service": { + "shortName": "ReservationService", + "fullName": "google.cloud.bigquery.reservation.v1.ReservationService" + } + } + } + } + ] +} diff --git a/owl-bot-staging/google-cloud-bigquery-reservation/v1/src/index.ts b/owl-bot-staging/google-cloud-bigquery-reservation/v1/src/index.ts new file mode 100644 index 00000000000..0f2e9cd8dd4 --- /dev/null +++ b/owl-bot-staging/google-cloud-bigquery-reservation/v1/src/index.ts @@ -0,0 +1,25 @@ +// Copyright 2023 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 +// +// https://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. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + +import * as v1 from './v1'; +const ReservationServiceClient = v1.ReservationServiceClient; +type ReservationServiceClient = v1.ReservationServiceClient; +export {v1, ReservationServiceClient}; +export default {v1, ReservationServiceClient}; +import * as protos from '../protos/protos'; +export {protos} diff --git a/owl-bot-staging/google-cloud-bigquery-reservation/v1/src/v1/gapic_metadata.json b/owl-bot-staging/google-cloud-bigquery-reservation/v1/src/v1/gapic_metadata.json new file mode 100644 index 00000000000..03838a39d9b --- /dev/null +++ b/owl-bot-staging/google-cloud-bigquery-reservation/v1/src/v1/gapic_metadata.json @@ -0,0 +1,253 @@ +{ + "schema": "1.0", + "comment": "This file maps proto services/RPCs to the corresponding library clients/methods", + "language": "typescript", + "protoPackage": "google.cloud.bigquery.reservation.v1", + "libraryPackage": "@google-cloud/bigquery-reservation", + "services": { + "ReservationService": { + "clients": { + "grpc": { + "libraryClient": "ReservationServiceClient", + "rpcs": { + "CreateReservation": { + "methods": [ + "createReservation" + ] + }, + "GetReservation": { + "methods": [ + "getReservation" + ] + }, + "DeleteReservation": { + "methods": [ + "deleteReservation" + ] + }, + "UpdateReservation": { + "methods": [ + "updateReservation" + ] + }, + "CreateCapacityCommitment": { + "methods": [ + "createCapacityCommitment" + ] + }, + "GetCapacityCommitment": { + "methods": [ + "getCapacityCommitment" + ] + }, + "DeleteCapacityCommitment": { + "methods": [ + "deleteCapacityCommitment" + ] + }, + "UpdateCapacityCommitment": { + "methods": [ + "updateCapacityCommitment" + ] + }, + "SplitCapacityCommitment": { + "methods": [ + "splitCapacityCommitment" + ] + }, + "MergeCapacityCommitments": { + "methods": [ + "mergeCapacityCommitments" + ] + }, + "CreateAssignment": { + "methods": [ + "createAssignment" + ] + }, + "DeleteAssignment": { + "methods": [ + "deleteAssignment" + ] + }, + "MoveAssignment": { + "methods": [ + "moveAssignment" + ] + }, + "UpdateAssignment": { + "methods": [ + "updateAssignment" + ] + }, + "GetBiReservation": { + "methods": [ + "getBiReservation" + ] + }, + "UpdateBiReservation": { + "methods": [ + "updateBiReservation" + ] + }, + "ListReservations": { + "methods": [ + "listReservations", + "listReservationsStream", + "listReservationsAsync" + ] + }, + "ListCapacityCommitments": { + "methods": [ + "listCapacityCommitments", + "listCapacityCommitmentsStream", + "listCapacityCommitmentsAsync" + ] + }, + "ListAssignments": { + "methods": [ + "listAssignments", + "listAssignmentsStream", + "listAssignmentsAsync" + ] + }, + "SearchAssignments": { + "methods": [ + "searchAssignments", + "searchAssignmentsStream", + "searchAssignmentsAsync" + ] + }, + "SearchAllAssignments": { + "methods": [ + "searchAllAssignments", + "searchAllAssignmentsStream", + "searchAllAssignmentsAsync" + ] + } + } + }, + "grpc-fallback": { + "libraryClient": "ReservationServiceClient", + "rpcs": { + "CreateReservation": { + "methods": [ + "createReservation" + ] + }, + "GetReservation": { + "methods": [ + "getReservation" + ] + }, + "DeleteReservation": { + "methods": [ + "deleteReservation" + ] + }, + "UpdateReservation": { + "methods": [ + "updateReservation" + ] + }, + "CreateCapacityCommitment": { + "methods": [ + "createCapacityCommitment" + ] + }, + "GetCapacityCommitment": { + "methods": [ + "getCapacityCommitment" + ] + }, + "DeleteCapacityCommitment": { + "methods": [ + "deleteCapacityCommitment" + ] + }, + "UpdateCapacityCommitment": { + "methods": [ + "updateCapacityCommitment" + ] + }, + "SplitCapacityCommitment": { + "methods": [ + "splitCapacityCommitment" + ] + }, + "MergeCapacityCommitments": { + "methods": [ + "mergeCapacityCommitments" + ] + }, + "CreateAssignment": { + "methods": [ + "createAssignment" + ] + }, + "DeleteAssignment": { + "methods": [ + "deleteAssignment" + ] + }, + "MoveAssignment": { + "methods": [ + "moveAssignment" + ] + }, + "UpdateAssignment": { + "methods": [ + "updateAssignment" + ] + }, + "GetBiReservation": { + "methods": [ + "getBiReservation" + ] + }, + "UpdateBiReservation": { + "methods": [ + "updateBiReservation" + ] + }, + "ListReservations": { + "methods": [ + "listReservations", + "listReservationsStream", + "listReservationsAsync" + ] + }, + "ListCapacityCommitments": { + "methods": [ + "listCapacityCommitments", + "listCapacityCommitmentsStream", + "listCapacityCommitmentsAsync" + ] + }, + "ListAssignments": { + "methods": [ + "listAssignments", + "listAssignmentsStream", + "listAssignmentsAsync" + ] + }, + "SearchAssignments": { + "methods": [ + "searchAssignments", + "searchAssignmentsStream", + "searchAssignmentsAsync" + ] + }, + "SearchAllAssignments": { + "methods": [ + "searchAllAssignments", + "searchAllAssignmentsStream", + "searchAllAssignmentsAsync" + ] + } + } + } + } + } + } +} diff --git a/owl-bot-staging/google-cloud-bigquery-reservation/v1/src/v1/index.ts b/owl-bot-staging/google-cloud-bigquery-reservation/v1/src/v1/index.ts new file mode 100644 index 00000000000..c9be59e652f --- /dev/null +++ b/owl-bot-staging/google-cloud-bigquery-reservation/v1/src/v1/index.ts @@ -0,0 +1,19 @@ +// Copyright 2023 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 +// +// https://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. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + +export {ReservationServiceClient} from './reservation_service_client'; diff --git a/owl-bot-staging/google-cloud-bigquery-reservation/v1/src/v1/reservation_service_client.ts b/owl-bot-staging/google-cloud-bigquery-reservation/v1/src/v1/reservation_service_client.ts new file mode 100644 index 00000000000..13af8d73b8c --- /dev/null +++ b/owl-bot-staging/google-cloud-bigquery-reservation/v1/src/v1/reservation_service_client.ts @@ -0,0 +1,2924 @@ +// Copyright 2023 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 +// +// https://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. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + +/* global window */ +import type * as gax from 'google-gax'; +import type {Callback, CallOptions, Descriptors, ClientOptions, PaginationCallback, GaxCall} from 'google-gax'; +import {Transform} from 'stream'; +import * as protos from '../../protos/protos'; +import jsonProtos = require('../../protos/protos.json'); +/** + * Client JSON configuration object, loaded from + * `src/v1/reservation_service_client_config.json`. + * This file defines retry strategy and timeouts for all API methods in this library. + */ +import * as gapicConfig from './reservation_service_client_config.json'; +const version = require('../../../package.json').version; + +/** + * This API allows users to manage their flat-rate BigQuery reservations. + * + * A reservation provides computational resource guarantees, in the form of + * [slots](https://cloud.google.com/bigquery/docs/slots), to users. A slot is a + * unit of computational power in BigQuery, and serves as the basic unit of + * parallelism. In a scan of a multi-partitioned table, a single slot operates + * on a single partition of the table. A reservation resource exists as a child + * resource of the admin project and location, e.g.: + * `projects/myproject/locations/US/reservations/reservationName`. + * + * A capacity commitment is a way to purchase compute capacity for BigQuery jobs + * (in the form of slots) with some committed period of usage. A capacity + * commitment resource exists as a child resource of the admin project and + * location, e.g.: + * `projects/myproject/locations/US/capacityCommitments/id`. + * @class + * @memberof v1 + */ +export class ReservationServiceClient { + private _terminated = false; + private _opts: ClientOptions; + private _providedCustomServicePath: boolean; + private _gaxModule: typeof gax | typeof gax.fallback; + private _gaxGrpc: gax.GrpcClient | gax.fallback.GrpcClient; + private _protos: {}; + private _defaults: {[method: string]: gax.CallSettings}; + auth: gax.GoogleAuth; + descriptors: Descriptors = { + page: {}, + stream: {}, + longrunning: {}, + batching: {}, + }; + warn: (code: string, message: string, warnType?: string) => void; + innerApiCalls: {[name: string]: Function}; + pathTemplates: {[name: string]: gax.PathTemplate}; + reservationServiceStub?: Promise<{[name: string]: Function}>; + + /** + * Construct an instance of ReservationServiceClient. + * + * @param {object} [options] - The configuration object. + * The options accepted by the constructor are described in detail + * in [this document](https://github.com/googleapis/gax-nodejs/blob/main/client-libraries.md#creating-the-client-instance). + * The common options are: + * @param {object} [options.credentials] - Credentials object. + * @param {string} [options.credentials.client_email] + * @param {string} [options.credentials.private_key] + * @param {string} [options.email] - Account email address. Required when + * using a .pem or .p12 keyFilename. + * @param {string} [options.keyFilename] - Full path to the a .json, .pem, or + * .p12 key downloaded from the Google Developers Console. If you provide + * a path to a JSON file, the projectId option below is not necessary. + * NOTE: .pem and .p12 require you to specify options.email as well. + * @param {number} [options.port] - The port on which to connect to + * the remote host. + * @param {string} [options.projectId] - The project ID from the Google + * Developer's Console, e.g. 'grape-spaceship-123'. We will also check + * the environment variable GCLOUD_PROJECT for your project ID. If your + * app is running in an environment which supports + * {@link https://developers.google.com/identity/protocols/application-default-credentials Application Default Credentials}, + * your project ID will be detected automatically. + * @param {string} [options.apiEndpoint] - The domain name of the + * API remote host. + * @param {gax.ClientConfig} [options.clientConfig] - Client configuration override. + * Follows the structure of {@link gapicConfig}. + * @param {boolean | "rest"} [options.fallback] - Use HTTP fallback mode. + * Pass "rest" to use HTTP/1.1 REST API instead of gRPC. + * For more information, please check the + * {@link https://github.com/googleapis/gax-nodejs/blob/main/client-libraries.md#http11-rest-api-mode documentation}. + * @param {gax} [gaxInstance]: loaded instance of `google-gax`. Useful if you + * need to avoid loading the default gRPC version and want to use the fallback + * HTTP implementation. Load only fallback version and pass it to the constructor: + * ``` + * const gax = require('google-gax/build/src/fallback'); // avoids loading google-gax with gRPC + * const client = new ReservationServiceClient({fallback: 'rest'}, gax); + * ``` + */ + constructor(opts?: ClientOptions, gaxInstance?: typeof gax | typeof gax.fallback) { + // Ensure that options include all the required fields. + const staticMembers = this.constructor as typeof ReservationServiceClient; + const servicePath = opts?.servicePath || opts?.apiEndpoint || staticMembers.servicePath; + this._providedCustomServicePath = !!(opts?.servicePath || opts?.apiEndpoint); + const port = opts?.port || staticMembers.port; + const clientConfig = opts?.clientConfig ?? {}; + const fallback = opts?.fallback ?? (typeof window !== 'undefined' && typeof window?.fetch === 'function'); + opts = Object.assign({servicePath, port, clientConfig, fallback}, opts); + + // Request numeric enum values if REST transport is used. + opts.numericEnums = true; + + // If scopes are unset in options and we're connecting to a non-default endpoint, set scopes just in case. + if (servicePath !== staticMembers.servicePath && !('scopes' in opts)) { + opts['scopes'] = staticMembers.scopes; + } + + // Load google-gax module synchronously if needed + if (!gaxInstance) { + gaxInstance = require('google-gax') as typeof gax; + } + + // Choose either gRPC or proto-over-HTTP implementation of google-gax. + this._gaxModule = opts.fallback ? gaxInstance.fallback : gaxInstance; + + // Create a `gaxGrpc` object, with any grpc-specific options sent to the client. + this._gaxGrpc = new this._gaxModule.GrpcClient(opts); + + // Save options to use in initialize() method. + this._opts = opts; + + // Save the auth object to the client, for use by other methods. + this.auth = (this._gaxGrpc.auth as gax.GoogleAuth); + + // Set useJWTAccessWithScope on the auth object. + this.auth.useJWTAccessWithScope = true; + + // Set defaultServicePath on the auth object. + this.auth.defaultServicePath = staticMembers.servicePath; + + // Set the default scopes in auth client if needed. + if (servicePath === staticMembers.servicePath) { + this.auth.defaultScopes = staticMembers.scopes; + } + + // Determine the client header string. + const clientHeader = [ + `gax/${this._gaxModule.version}`, + `gapic/${version}`, + ]; + if (typeof process !== 'undefined' && 'versions' in process) { + clientHeader.push(`gl-node/${process.versions.node}`); + } else { + clientHeader.push(`gl-web/${this._gaxModule.version}`); + } + if (!opts.fallback) { + clientHeader.push(`grpc/${this._gaxGrpc.grpcVersion}`); + } else if (opts.fallback === 'rest' ) { + clientHeader.push(`rest/${this._gaxGrpc.grpcVersion}`); + } + if (opts.libName && opts.libVersion) { + clientHeader.push(`${opts.libName}/${opts.libVersion}`); + } + // Load the applicable protos. + this._protos = this._gaxGrpc.loadProtoJSON(jsonProtos); + + // This API contains "path templates"; forward-slash-separated + // identifiers to uniquely identify resources within the API. + // Create useful helper objects for these. + this.pathTemplates = { + assignmentPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/reservations/{reservation}/assignments/{assignment}' + ), + biReservationPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/biReservation' + ), + capacityCommitmentPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/capacityCommitments/{capacity_commitment}' + ), + locationPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}' + ), + projectPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}' + ), + reservationPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/reservations/{reservation}' + ), + }; + + // Some of the methods on this service return "paged" results, + // (e.g. 50 results at a time, with tokens to get subsequent + // pages). Denote the keys used for pagination and results. + this.descriptors.page = { + listReservations: + new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'reservations'), + listCapacityCommitments: + new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'capacityCommitments'), + listAssignments: + new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'assignments'), + searchAssignments: + new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'assignments'), + searchAllAssignments: + new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'assignments') + }; + + // Put together the default options sent with requests. + this._defaults = this._gaxGrpc.constructSettings( + 'google.cloud.bigquery.reservation.v1.ReservationService', gapicConfig as gax.ClientConfig, + opts.clientConfig || {}, {'x-goog-api-client': clientHeader.join(' ')}); + + // Set up a dictionary of "inner API calls"; the core implementation + // of calling the API is handled in `google-gax`, with this code + // merely providing the destination and request information. + this.innerApiCalls = {}; + + // Add a warn function to the client constructor so it can be easily tested. + this.warn = this._gaxModule.warn; + } + + /** + * Initialize the client. + * Performs asynchronous operations (such as authentication) and prepares the client. + * This function will be called automatically when any class method is called for the + * first time, but if you need to initialize it before calling an actual method, + * feel free to call initialize() directly. + * + * You can await on this method if you want to make sure the client is initialized. + * + * @returns {Promise} A promise that resolves to an authenticated service stub. + */ + initialize() { + // If the client stub promise is already initialized, return immediately. + if (this.reservationServiceStub) { + return this.reservationServiceStub; + } + + // Put together the "service stub" for + // google.cloud.bigquery.reservation.v1.ReservationService. + this.reservationServiceStub = this._gaxGrpc.createStub( + this._opts.fallback ? + (this._protos as protobuf.Root).lookupService('google.cloud.bigquery.reservation.v1.ReservationService') : + // eslint-disable-next-line @typescript-eslint/no-explicit-any + (this._protos as any).google.cloud.bigquery.reservation.v1.ReservationService, + this._opts, this._providedCustomServicePath) as Promise<{[method: string]: Function}>; + + // Iterate over each of the methods that the service provides + // and create an API call method for each. + const reservationServiceStubMethods = + ['createReservation', 'listReservations', 'getReservation', 'deleteReservation', 'updateReservation', 'createCapacityCommitment', 'listCapacityCommitments', 'getCapacityCommitment', 'deleteCapacityCommitment', 'updateCapacityCommitment', 'splitCapacityCommitment', 'mergeCapacityCommitments', 'createAssignment', 'listAssignments', 'deleteAssignment', 'searchAssignments', 'searchAllAssignments', 'moveAssignment', 'updateAssignment', 'getBiReservation', 'updateBiReservation']; + for (const methodName of reservationServiceStubMethods) { + const callPromise = this.reservationServiceStub.then( + stub => (...args: Array<{}>) => { + if (this._terminated) { + return Promise.reject('The client has already been closed.'); + } + const func = stub[methodName]; + return func.apply(stub, args); + }, + (err: Error|null|undefined) => () => { + throw err; + }); + + const descriptor = + this.descriptors.page[methodName] || + undefined; + const apiCall = this._gaxModule.createApiCall( + callPromise, + this._defaults[methodName], + descriptor, + this._opts.fallback + ); + + this.innerApiCalls[methodName] = apiCall; + } + + return this.reservationServiceStub; + } + + /** + * The DNS address for this API service. + * @returns {string} The DNS address for this service. + */ + static get servicePath() { + return 'bigqueryreservation.googleapis.com'; + } + + /** + * The DNS address for this API service - same as servicePath(), + * exists for compatibility reasons. + * @returns {string} The DNS address for this service. + */ + static get apiEndpoint() { + return 'bigqueryreservation.googleapis.com'; + } + + /** + * The port for this API service. + * @returns {number} The default port for this service. + */ + static get port() { + return 443; + } + + /** + * The scopes needed to make gRPC calls for every method defined + * in this service. + * @returns {string[]} List of default scopes. + */ + static get scopes() { + return [ + 'https://www.googleapis.com/auth/bigquery', + 'https://www.googleapis.com/auth/cloud-platform' + ]; + } + + getProjectId(): Promise; + getProjectId(callback: Callback): void; + /** + * Return the project ID used by this class. + * @returns {Promise} A promise that resolves to string containing the project ID. + */ + getProjectId(callback?: Callback): + Promise|void { + if (callback) { + this.auth.getProjectId(callback); + return; + } + return this.auth.getProjectId(); + } + + // ------------------- + // -- Service calls -- + // ------------------- +/** + * Creates a new reservation resource. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. Project, location. E.g., + * `projects/myproject/locations/US` + * @param {string} request.reservationId + * The reservation ID. It must only contain lower case alphanumeric + * characters or dashes. It must start with a letter and must not end + * with a dash. Its maximum length is 64 characters. + * @param {google.cloud.bigquery.reservation.v1.Reservation} request.reservation + * Definition of the new reservation to create. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link google.cloud.bigquery.reservation.v1.Reservation | Reservation}. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) + * for more details and examples. + * @example include:samples/generated/v1/reservation_service.create_reservation.js + * region_tag:bigqueryreservation_v1_generated_ReservationService_CreateReservation_async + */ + createReservation( + request?: protos.google.cloud.bigquery.reservation.v1.ICreateReservationRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.bigquery.reservation.v1.IReservation, + protos.google.cloud.bigquery.reservation.v1.ICreateReservationRequest|undefined, {}|undefined + ]>; + createReservation( + request: protos.google.cloud.bigquery.reservation.v1.ICreateReservationRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.bigquery.reservation.v1.IReservation, + protos.google.cloud.bigquery.reservation.v1.ICreateReservationRequest|null|undefined, + {}|null|undefined>): void; + createReservation( + request: protos.google.cloud.bigquery.reservation.v1.ICreateReservationRequest, + callback: Callback< + protos.google.cloud.bigquery.reservation.v1.IReservation, + protos.google.cloud.bigquery.reservation.v1.ICreateReservationRequest|null|undefined, + {}|null|undefined>): void; + createReservation( + request?: protos.google.cloud.bigquery.reservation.v1.ICreateReservationRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.cloud.bigquery.reservation.v1.IReservation, + protos.google.cloud.bigquery.reservation.v1.ICreateReservationRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.cloud.bigquery.reservation.v1.IReservation, + protos.google.cloud.bigquery.reservation.v1.ICreateReservationRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.cloud.bigquery.reservation.v1.IReservation, + protos.google.cloud.bigquery.reservation.v1.ICreateReservationRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'parent': request.parent ?? '', + }); + this.initialize(); + return this.innerApiCalls.createReservation(request, options, callback); + } +/** + * Returns information about the reservation. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. Resource name of the reservation to retrieve. E.g., + * `projects/myproject/locations/US/reservations/team1-prod` + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link google.cloud.bigquery.reservation.v1.Reservation | Reservation}. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) + * for more details and examples. + * @example include:samples/generated/v1/reservation_service.get_reservation.js + * region_tag:bigqueryreservation_v1_generated_ReservationService_GetReservation_async + */ + getReservation( + request?: protos.google.cloud.bigquery.reservation.v1.IGetReservationRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.bigquery.reservation.v1.IReservation, + protos.google.cloud.bigquery.reservation.v1.IGetReservationRequest|undefined, {}|undefined + ]>; + getReservation( + request: protos.google.cloud.bigquery.reservation.v1.IGetReservationRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.bigquery.reservation.v1.IReservation, + protos.google.cloud.bigquery.reservation.v1.IGetReservationRequest|null|undefined, + {}|null|undefined>): void; + getReservation( + request: protos.google.cloud.bigquery.reservation.v1.IGetReservationRequest, + callback: Callback< + protos.google.cloud.bigquery.reservation.v1.IReservation, + protos.google.cloud.bigquery.reservation.v1.IGetReservationRequest|null|undefined, + {}|null|undefined>): void; + getReservation( + request?: protos.google.cloud.bigquery.reservation.v1.IGetReservationRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.cloud.bigquery.reservation.v1.IReservation, + protos.google.cloud.bigquery.reservation.v1.IGetReservationRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.cloud.bigquery.reservation.v1.IReservation, + protos.google.cloud.bigquery.reservation.v1.IGetReservationRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.cloud.bigquery.reservation.v1.IReservation, + protos.google.cloud.bigquery.reservation.v1.IGetReservationRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'name': request.name ?? '', + }); + this.initialize(); + return this.innerApiCalls.getReservation(request, options, callback); + } +/** + * Deletes a reservation. + * Returns `google.rpc.Code.FAILED_PRECONDITION` when reservation has + * assignments. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. Resource name of the reservation to retrieve. E.g., + * `projects/myproject/locations/US/reservations/team1-prod` + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link google.protobuf.Empty | Empty}. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) + * for more details and examples. + * @example include:samples/generated/v1/reservation_service.delete_reservation.js + * region_tag:bigqueryreservation_v1_generated_ReservationService_DeleteReservation_async + */ + deleteReservation( + request?: protos.google.cloud.bigquery.reservation.v1.IDeleteReservationRequest, + options?: CallOptions): + Promise<[ + protos.google.protobuf.IEmpty, + protos.google.cloud.bigquery.reservation.v1.IDeleteReservationRequest|undefined, {}|undefined + ]>; + deleteReservation( + request: protos.google.cloud.bigquery.reservation.v1.IDeleteReservationRequest, + options: CallOptions, + callback: Callback< + protos.google.protobuf.IEmpty, + protos.google.cloud.bigquery.reservation.v1.IDeleteReservationRequest|null|undefined, + {}|null|undefined>): void; + deleteReservation( + request: protos.google.cloud.bigquery.reservation.v1.IDeleteReservationRequest, + callback: Callback< + protos.google.protobuf.IEmpty, + protos.google.cloud.bigquery.reservation.v1.IDeleteReservationRequest|null|undefined, + {}|null|undefined>): void; + deleteReservation( + request?: protos.google.cloud.bigquery.reservation.v1.IDeleteReservationRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.protobuf.IEmpty, + protos.google.cloud.bigquery.reservation.v1.IDeleteReservationRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.protobuf.IEmpty, + protos.google.cloud.bigquery.reservation.v1.IDeleteReservationRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.protobuf.IEmpty, + protos.google.cloud.bigquery.reservation.v1.IDeleteReservationRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'name': request.name ?? '', + }); + this.initialize(); + return this.innerApiCalls.deleteReservation(request, options, callback); + } +/** + * Updates an existing reservation resource. + * + * @param {Object} request + * The request object that will be sent. + * @param {google.cloud.bigquery.reservation.v1.Reservation} request.reservation + * Content of the reservation to update. + * @param {google.protobuf.FieldMask} request.updateMask + * Standard field mask for the set of fields to be updated. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link google.cloud.bigquery.reservation.v1.Reservation | Reservation}. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) + * for more details and examples. + * @example include:samples/generated/v1/reservation_service.update_reservation.js + * region_tag:bigqueryreservation_v1_generated_ReservationService_UpdateReservation_async + */ + updateReservation( + request?: protos.google.cloud.bigquery.reservation.v1.IUpdateReservationRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.bigquery.reservation.v1.IReservation, + protos.google.cloud.bigquery.reservation.v1.IUpdateReservationRequest|undefined, {}|undefined + ]>; + updateReservation( + request: protos.google.cloud.bigquery.reservation.v1.IUpdateReservationRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.bigquery.reservation.v1.IReservation, + protos.google.cloud.bigquery.reservation.v1.IUpdateReservationRequest|null|undefined, + {}|null|undefined>): void; + updateReservation( + request: protos.google.cloud.bigquery.reservation.v1.IUpdateReservationRequest, + callback: Callback< + protos.google.cloud.bigquery.reservation.v1.IReservation, + protos.google.cloud.bigquery.reservation.v1.IUpdateReservationRequest|null|undefined, + {}|null|undefined>): void; + updateReservation( + request?: protos.google.cloud.bigquery.reservation.v1.IUpdateReservationRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.cloud.bigquery.reservation.v1.IReservation, + protos.google.cloud.bigquery.reservation.v1.IUpdateReservationRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.cloud.bigquery.reservation.v1.IReservation, + protos.google.cloud.bigquery.reservation.v1.IUpdateReservationRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.cloud.bigquery.reservation.v1.IReservation, + protos.google.cloud.bigquery.reservation.v1.IUpdateReservationRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'reservation.name': request.reservation!.name ?? '', + }); + this.initialize(); + return this.innerApiCalls.updateReservation(request, options, callback); + } +/** + * Creates a new capacity commitment resource. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. Resource name of the parent reservation. E.g., + * `projects/myproject/locations/US` + * @param {google.cloud.bigquery.reservation.v1.CapacityCommitment} request.capacityCommitment + * Content of the capacity commitment to create. + * @param {boolean} request.enforceSingleAdminProjectPerOrg + * If true, fail the request if another project in the organization has a + * capacity commitment. + * @param {string} request.capacityCommitmentId + * 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 dashes. + * The first and last character cannot be a dash. Max length is 64 characters. + * NOTE: this ID won't be kept if the capacity commitment is split or merged. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link google.cloud.bigquery.reservation.v1.CapacityCommitment | CapacityCommitment}. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) + * for more details and examples. + * @example include:samples/generated/v1/reservation_service.create_capacity_commitment.js + * region_tag:bigqueryreservation_v1_generated_ReservationService_CreateCapacityCommitment_async + */ + createCapacityCommitment( + request?: protos.google.cloud.bigquery.reservation.v1.ICreateCapacityCommitmentRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.bigquery.reservation.v1.ICapacityCommitment, + protos.google.cloud.bigquery.reservation.v1.ICreateCapacityCommitmentRequest|undefined, {}|undefined + ]>; + createCapacityCommitment( + request: protos.google.cloud.bigquery.reservation.v1.ICreateCapacityCommitmentRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.bigquery.reservation.v1.ICapacityCommitment, + protos.google.cloud.bigquery.reservation.v1.ICreateCapacityCommitmentRequest|null|undefined, + {}|null|undefined>): void; + createCapacityCommitment( + request: protos.google.cloud.bigquery.reservation.v1.ICreateCapacityCommitmentRequest, + callback: Callback< + protos.google.cloud.bigquery.reservation.v1.ICapacityCommitment, + protos.google.cloud.bigquery.reservation.v1.ICreateCapacityCommitmentRequest|null|undefined, + {}|null|undefined>): void; + createCapacityCommitment( + request?: protos.google.cloud.bigquery.reservation.v1.ICreateCapacityCommitmentRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.cloud.bigquery.reservation.v1.ICapacityCommitment, + protos.google.cloud.bigquery.reservation.v1.ICreateCapacityCommitmentRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.cloud.bigquery.reservation.v1.ICapacityCommitment, + protos.google.cloud.bigquery.reservation.v1.ICreateCapacityCommitmentRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.cloud.bigquery.reservation.v1.ICapacityCommitment, + protos.google.cloud.bigquery.reservation.v1.ICreateCapacityCommitmentRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'parent': request.parent ?? '', + }); + this.initialize(); + return this.innerApiCalls.createCapacityCommitment(request, options, callback); + } +/** + * Returns information about the capacity commitment. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. Resource name of the capacity commitment to retrieve. E.g., + * `projects/myproject/locations/US/capacityCommitments/123` + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link google.cloud.bigquery.reservation.v1.CapacityCommitment | CapacityCommitment}. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) + * for more details and examples. + * @example include:samples/generated/v1/reservation_service.get_capacity_commitment.js + * region_tag:bigqueryreservation_v1_generated_ReservationService_GetCapacityCommitment_async + */ + getCapacityCommitment( + request?: protos.google.cloud.bigquery.reservation.v1.IGetCapacityCommitmentRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.bigquery.reservation.v1.ICapacityCommitment, + protos.google.cloud.bigquery.reservation.v1.IGetCapacityCommitmentRequest|undefined, {}|undefined + ]>; + getCapacityCommitment( + request: protos.google.cloud.bigquery.reservation.v1.IGetCapacityCommitmentRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.bigquery.reservation.v1.ICapacityCommitment, + protos.google.cloud.bigquery.reservation.v1.IGetCapacityCommitmentRequest|null|undefined, + {}|null|undefined>): void; + getCapacityCommitment( + request: protos.google.cloud.bigquery.reservation.v1.IGetCapacityCommitmentRequest, + callback: Callback< + protos.google.cloud.bigquery.reservation.v1.ICapacityCommitment, + protos.google.cloud.bigquery.reservation.v1.IGetCapacityCommitmentRequest|null|undefined, + {}|null|undefined>): void; + getCapacityCommitment( + request?: protos.google.cloud.bigquery.reservation.v1.IGetCapacityCommitmentRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.cloud.bigquery.reservation.v1.ICapacityCommitment, + protos.google.cloud.bigquery.reservation.v1.IGetCapacityCommitmentRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.cloud.bigquery.reservation.v1.ICapacityCommitment, + protos.google.cloud.bigquery.reservation.v1.IGetCapacityCommitmentRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.cloud.bigquery.reservation.v1.ICapacityCommitment, + protos.google.cloud.bigquery.reservation.v1.IGetCapacityCommitmentRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'name': request.name ?? '', + }); + this.initialize(); + return this.innerApiCalls.getCapacityCommitment(request, options, callback); + } +/** + * Deletes a capacity commitment. Attempting to delete capacity commitment + * before its commitment_end_time will fail with the error code + * `google.rpc.Code.FAILED_PRECONDITION`. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. Resource name of the capacity commitment to delete. E.g., + * `projects/myproject/locations/US/capacityCommitments/123` + * @param {boolean} request.force + * 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. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link google.protobuf.Empty | Empty}. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) + * for more details and examples. + * @example include:samples/generated/v1/reservation_service.delete_capacity_commitment.js + * region_tag:bigqueryreservation_v1_generated_ReservationService_DeleteCapacityCommitment_async + */ + deleteCapacityCommitment( + request?: protos.google.cloud.bigquery.reservation.v1.IDeleteCapacityCommitmentRequest, + options?: CallOptions): + Promise<[ + protos.google.protobuf.IEmpty, + protos.google.cloud.bigquery.reservation.v1.IDeleteCapacityCommitmentRequest|undefined, {}|undefined + ]>; + deleteCapacityCommitment( + request: protos.google.cloud.bigquery.reservation.v1.IDeleteCapacityCommitmentRequest, + options: CallOptions, + callback: Callback< + protos.google.protobuf.IEmpty, + protos.google.cloud.bigquery.reservation.v1.IDeleteCapacityCommitmentRequest|null|undefined, + {}|null|undefined>): void; + deleteCapacityCommitment( + request: protos.google.cloud.bigquery.reservation.v1.IDeleteCapacityCommitmentRequest, + callback: Callback< + protos.google.protobuf.IEmpty, + protos.google.cloud.bigquery.reservation.v1.IDeleteCapacityCommitmentRequest|null|undefined, + {}|null|undefined>): void; + deleteCapacityCommitment( + request?: protos.google.cloud.bigquery.reservation.v1.IDeleteCapacityCommitmentRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.protobuf.IEmpty, + protos.google.cloud.bigquery.reservation.v1.IDeleteCapacityCommitmentRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.protobuf.IEmpty, + protos.google.cloud.bigquery.reservation.v1.IDeleteCapacityCommitmentRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.protobuf.IEmpty, + protos.google.cloud.bigquery.reservation.v1.IDeleteCapacityCommitmentRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'name': request.name ?? '', + }); + this.initialize(); + return this.innerApiCalls.deleteCapacityCommitment(request, options, callback); + } +/** + * Updates an existing capacity commitment. + * + * Only `plan` and `renewal_plan` fields can be updated. + * + * Plan can only be changed to a plan of a longer commitment period. + * Attempting to change to a plan with shorter commitment period will fail + * with the error code `google.rpc.Code.FAILED_PRECONDITION`. + * + * @param {Object} request + * The request object that will be sent. + * @param {google.cloud.bigquery.reservation.v1.CapacityCommitment} request.capacityCommitment + * Content of the capacity commitment to update. + * @param {google.protobuf.FieldMask} request.updateMask + * Standard field mask for the set of fields to be updated. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link google.cloud.bigquery.reservation.v1.CapacityCommitment | CapacityCommitment}. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) + * for more details and examples. + * @example include:samples/generated/v1/reservation_service.update_capacity_commitment.js + * region_tag:bigqueryreservation_v1_generated_ReservationService_UpdateCapacityCommitment_async + */ + updateCapacityCommitment( + request?: protos.google.cloud.bigquery.reservation.v1.IUpdateCapacityCommitmentRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.bigquery.reservation.v1.ICapacityCommitment, + protos.google.cloud.bigquery.reservation.v1.IUpdateCapacityCommitmentRequest|undefined, {}|undefined + ]>; + updateCapacityCommitment( + request: protos.google.cloud.bigquery.reservation.v1.IUpdateCapacityCommitmentRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.bigquery.reservation.v1.ICapacityCommitment, + protos.google.cloud.bigquery.reservation.v1.IUpdateCapacityCommitmentRequest|null|undefined, + {}|null|undefined>): void; + updateCapacityCommitment( + request: protos.google.cloud.bigquery.reservation.v1.IUpdateCapacityCommitmentRequest, + callback: Callback< + protos.google.cloud.bigquery.reservation.v1.ICapacityCommitment, + protos.google.cloud.bigquery.reservation.v1.IUpdateCapacityCommitmentRequest|null|undefined, + {}|null|undefined>): void; + updateCapacityCommitment( + request?: protos.google.cloud.bigquery.reservation.v1.IUpdateCapacityCommitmentRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.cloud.bigquery.reservation.v1.ICapacityCommitment, + protos.google.cloud.bigquery.reservation.v1.IUpdateCapacityCommitmentRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.cloud.bigquery.reservation.v1.ICapacityCommitment, + protos.google.cloud.bigquery.reservation.v1.IUpdateCapacityCommitmentRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.cloud.bigquery.reservation.v1.ICapacityCommitment, + protos.google.cloud.bigquery.reservation.v1.IUpdateCapacityCommitmentRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'capacity_commitment.name': request.capacityCommitment!.name ?? '', + }); + this.initialize(); + return this.innerApiCalls.updateCapacityCommitment(request, options, callback); + } +/** + * Splits capacity commitment to two commitments of the same plan and + * `commitment_end_time`. + * + * A common use case is to enable downgrading commitments. + * + * For example, in order to downgrade from 10000 slots to 8000, you might + * split a 10000 capacity commitment into commitments of 2000 and 8000. Then, + * you delete the first one after the commitment end time passes. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The resource name e.g.,: + * `projects/myproject/locations/US/capacityCommitments/123` + * @param {number} request.slotCount + * Number of slots in the capacity commitment after the split. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link google.cloud.bigquery.reservation.v1.SplitCapacityCommitmentResponse | SplitCapacityCommitmentResponse}. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) + * for more details and examples. + * @example include:samples/generated/v1/reservation_service.split_capacity_commitment.js + * region_tag:bigqueryreservation_v1_generated_ReservationService_SplitCapacityCommitment_async + */ + splitCapacityCommitment( + request?: protos.google.cloud.bigquery.reservation.v1.ISplitCapacityCommitmentRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.bigquery.reservation.v1.ISplitCapacityCommitmentResponse, + protos.google.cloud.bigquery.reservation.v1.ISplitCapacityCommitmentRequest|undefined, {}|undefined + ]>; + splitCapacityCommitment( + request: protos.google.cloud.bigquery.reservation.v1.ISplitCapacityCommitmentRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.bigquery.reservation.v1.ISplitCapacityCommitmentResponse, + protos.google.cloud.bigquery.reservation.v1.ISplitCapacityCommitmentRequest|null|undefined, + {}|null|undefined>): void; + splitCapacityCommitment( + request: protos.google.cloud.bigquery.reservation.v1.ISplitCapacityCommitmentRequest, + callback: Callback< + protos.google.cloud.bigquery.reservation.v1.ISplitCapacityCommitmentResponse, + protos.google.cloud.bigquery.reservation.v1.ISplitCapacityCommitmentRequest|null|undefined, + {}|null|undefined>): void; + splitCapacityCommitment( + request?: protos.google.cloud.bigquery.reservation.v1.ISplitCapacityCommitmentRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.cloud.bigquery.reservation.v1.ISplitCapacityCommitmentResponse, + protos.google.cloud.bigquery.reservation.v1.ISplitCapacityCommitmentRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.cloud.bigquery.reservation.v1.ISplitCapacityCommitmentResponse, + protos.google.cloud.bigquery.reservation.v1.ISplitCapacityCommitmentRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.cloud.bigquery.reservation.v1.ISplitCapacityCommitmentResponse, + protos.google.cloud.bigquery.reservation.v1.ISplitCapacityCommitmentRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'name': request.name ?? '', + }); + this.initialize(); + return this.innerApiCalls.splitCapacityCommitment(request, options, callback); + } +/** + * Merges capacity commitments of the same plan into a single commitment. + * + * The resulting capacity commitment has the greater commitment_end_time + * out of the to-be-merged capacity commitments. + * + * Attempting to merge capacity commitments of different plan will fail + * with the error code `google.rpc.Code.FAILED_PRECONDITION`. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Parent resource that identifies admin project and location e.g., + * `projects/myproject/locations/us` + * @param {string[]} request.capacityCommitmentIds + * 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 + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link google.cloud.bigquery.reservation.v1.CapacityCommitment | CapacityCommitment}. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) + * for more details and examples. + * @example include:samples/generated/v1/reservation_service.merge_capacity_commitments.js + * region_tag:bigqueryreservation_v1_generated_ReservationService_MergeCapacityCommitments_async + */ + mergeCapacityCommitments( + request?: protos.google.cloud.bigquery.reservation.v1.IMergeCapacityCommitmentsRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.bigquery.reservation.v1.ICapacityCommitment, + protos.google.cloud.bigquery.reservation.v1.IMergeCapacityCommitmentsRequest|undefined, {}|undefined + ]>; + mergeCapacityCommitments( + request: protos.google.cloud.bigquery.reservation.v1.IMergeCapacityCommitmentsRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.bigquery.reservation.v1.ICapacityCommitment, + protos.google.cloud.bigquery.reservation.v1.IMergeCapacityCommitmentsRequest|null|undefined, + {}|null|undefined>): void; + mergeCapacityCommitments( + request: protos.google.cloud.bigquery.reservation.v1.IMergeCapacityCommitmentsRequest, + callback: Callback< + protos.google.cloud.bigquery.reservation.v1.ICapacityCommitment, + protos.google.cloud.bigquery.reservation.v1.IMergeCapacityCommitmentsRequest|null|undefined, + {}|null|undefined>): void; + mergeCapacityCommitments( + request?: protos.google.cloud.bigquery.reservation.v1.IMergeCapacityCommitmentsRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.cloud.bigquery.reservation.v1.ICapacityCommitment, + protos.google.cloud.bigquery.reservation.v1.IMergeCapacityCommitmentsRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.cloud.bigquery.reservation.v1.ICapacityCommitment, + protos.google.cloud.bigquery.reservation.v1.IMergeCapacityCommitmentsRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.cloud.bigquery.reservation.v1.ICapacityCommitment, + protos.google.cloud.bigquery.reservation.v1.IMergeCapacityCommitmentsRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'parent': request.parent ?? '', + }); + this.initialize(); + return this.innerApiCalls.mergeCapacityCommitments(request, options, callback); + } +/** + * Creates an assignment object which allows the given project to submit jobs + * of a certain type using slots from the specified reservation. + * + * Currently a + * resource (project, folder, organization) can only have one assignment per + * each (job_type, location) combination, and that reservation will be used + * for all jobs of the matching type. + * + * Different assignments can be created on different levels of the + * projects, folders or organization hierarchy. During query execution, + * the assignment is looked up at the project, folder and organization levels + * in that order. The first assignment found is applied to the query. + * + * When creating assignments, it does not matter if other assignments exist at + * higher levels. + * + * Example: + * + * * The organization `organizationA` contains two projects, `project1` + * and `project2`. + * * Assignments for all three entities (`organizationA`, `project1`, and + * `project2`) could all be created and mapped to the same or different + * reservations. + * + * "None" assignments represent an absence of the assignment. Projects + * assigned to None use on-demand pricing. To create a "None" assignment, use + * "none" as a reservation_id in the parent. Example parent: + * `projects/myproject/locations/US/reservations/none`. + * + * Returns `google.rpc.Code.PERMISSION_DENIED` if user does not have + * 'bigquery.admin' permissions on the project using the reservation + * and the project that owns this reservation. + * + * Returns `google.rpc.Code.INVALID_ARGUMENT` when location of the assignment + * does not match location of the reservation. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The parent resource name of the assignment + * E.g. `projects/myproject/locations/US/reservations/team1-prod` + * @param {google.cloud.bigquery.reservation.v1.Assignment} request.assignment + * Assignment resource to create. + * @param {string} request.assignmentId + * 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 dashes. + * Max length is 64 characters. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link google.cloud.bigquery.reservation.v1.Assignment | Assignment}. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) + * for more details and examples. + * @example include:samples/generated/v1/reservation_service.create_assignment.js + * region_tag:bigqueryreservation_v1_generated_ReservationService_CreateAssignment_async + */ + createAssignment( + request?: protos.google.cloud.bigquery.reservation.v1.ICreateAssignmentRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.bigquery.reservation.v1.IAssignment, + protos.google.cloud.bigquery.reservation.v1.ICreateAssignmentRequest|undefined, {}|undefined + ]>; + createAssignment( + request: protos.google.cloud.bigquery.reservation.v1.ICreateAssignmentRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.bigquery.reservation.v1.IAssignment, + protos.google.cloud.bigquery.reservation.v1.ICreateAssignmentRequest|null|undefined, + {}|null|undefined>): void; + createAssignment( + request: protos.google.cloud.bigquery.reservation.v1.ICreateAssignmentRequest, + callback: Callback< + protos.google.cloud.bigquery.reservation.v1.IAssignment, + protos.google.cloud.bigquery.reservation.v1.ICreateAssignmentRequest|null|undefined, + {}|null|undefined>): void; + createAssignment( + request?: protos.google.cloud.bigquery.reservation.v1.ICreateAssignmentRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.cloud.bigquery.reservation.v1.IAssignment, + protos.google.cloud.bigquery.reservation.v1.ICreateAssignmentRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.cloud.bigquery.reservation.v1.IAssignment, + protos.google.cloud.bigquery.reservation.v1.ICreateAssignmentRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.cloud.bigquery.reservation.v1.IAssignment, + protos.google.cloud.bigquery.reservation.v1.ICreateAssignmentRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'parent': request.parent ?? '', + }); + this.initialize(); + return this.innerApiCalls.createAssignment(request, options, callback); + } +/** + * Deletes a assignment. No expansion will happen. + * + * Example: + * + * * Organization `organizationA` contains two projects, `project1` and + * `project2`. + * * Reservation `res1` exists and was created previously. + * * CreateAssignment was used previously to define the following + * associations between entities and reservations: `` + * and `` + * + * In this example, deletion of the `` assignment won't + * affect the other assignment ``. After said deletion, + * queries from `project1` will still use `res1` while queries from + * `project2` will switch to use on-demand mode. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. Name of the resource, e.g. + * `projects/myproject/locations/US/reservations/team1-prod/assignments/123` + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link google.protobuf.Empty | Empty}. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) + * for more details and examples. + * @example include:samples/generated/v1/reservation_service.delete_assignment.js + * region_tag:bigqueryreservation_v1_generated_ReservationService_DeleteAssignment_async + */ + deleteAssignment( + request?: protos.google.cloud.bigquery.reservation.v1.IDeleteAssignmentRequest, + options?: CallOptions): + Promise<[ + protos.google.protobuf.IEmpty, + protos.google.cloud.bigquery.reservation.v1.IDeleteAssignmentRequest|undefined, {}|undefined + ]>; + deleteAssignment( + request: protos.google.cloud.bigquery.reservation.v1.IDeleteAssignmentRequest, + options: CallOptions, + callback: Callback< + protos.google.protobuf.IEmpty, + protos.google.cloud.bigquery.reservation.v1.IDeleteAssignmentRequest|null|undefined, + {}|null|undefined>): void; + deleteAssignment( + request: protos.google.cloud.bigquery.reservation.v1.IDeleteAssignmentRequest, + callback: Callback< + protos.google.protobuf.IEmpty, + protos.google.cloud.bigquery.reservation.v1.IDeleteAssignmentRequest|null|undefined, + {}|null|undefined>): void; + deleteAssignment( + request?: protos.google.cloud.bigquery.reservation.v1.IDeleteAssignmentRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.protobuf.IEmpty, + protos.google.cloud.bigquery.reservation.v1.IDeleteAssignmentRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.protobuf.IEmpty, + protos.google.cloud.bigquery.reservation.v1.IDeleteAssignmentRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.protobuf.IEmpty, + protos.google.cloud.bigquery.reservation.v1.IDeleteAssignmentRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'name': request.name ?? '', + }); + this.initialize(); + return this.innerApiCalls.deleteAssignment(request, options, callback); + } +/** + * Moves an assignment under a new reservation. + * + * This differs from removing an existing assignment and recreating a new one + * by providing a transactional change that ensures an assignee always has an + * associated reservation. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The resource name of the assignment, + * e.g. + * `projects/myproject/locations/US/reservations/team1-prod/assignments/123` + * @param {string} request.destinationId + * The new reservation ID, e.g.: + * `projects/myotherproject/locations/US/reservations/team2-prod` + * @param {string} request.assignmentId + * The optional assignment ID. A new assignment name is generated if this + * field is empty. + * + * This field can contain only lowercase alphanumeric characters or dashes. + * Max length is 64 characters. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link google.cloud.bigquery.reservation.v1.Assignment | Assignment}. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) + * for more details and examples. + * @example include:samples/generated/v1/reservation_service.move_assignment.js + * region_tag:bigqueryreservation_v1_generated_ReservationService_MoveAssignment_async + */ + moveAssignment( + request?: protos.google.cloud.bigquery.reservation.v1.IMoveAssignmentRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.bigquery.reservation.v1.IAssignment, + protos.google.cloud.bigquery.reservation.v1.IMoveAssignmentRequest|undefined, {}|undefined + ]>; + moveAssignment( + request: protos.google.cloud.bigquery.reservation.v1.IMoveAssignmentRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.bigquery.reservation.v1.IAssignment, + protos.google.cloud.bigquery.reservation.v1.IMoveAssignmentRequest|null|undefined, + {}|null|undefined>): void; + moveAssignment( + request: protos.google.cloud.bigquery.reservation.v1.IMoveAssignmentRequest, + callback: Callback< + protos.google.cloud.bigquery.reservation.v1.IAssignment, + protos.google.cloud.bigquery.reservation.v1.IMoveAssignmentRequest|null|undefined, + {}|null|undefined>): void; + moveAssignment( + request?: protos.google.cloud.bigquery.reservation.v1.IMoveAssignmentRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.cloud.bigquery.reservation.v1.IAssignment, + protos.google.cloud.bigquery.reservation.v1.IMoveAssignmentRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.cloud.bigquery.reservation.v1.IAssignment, + protos.google.cloud.bigquery.reservation.v1.IMoveAssignmentRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.cloud.bigquery.reservation.v1.IAssignment, + protos.google.cloud.bigquery.reservation.v1.IMoveAssignmentRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'name': request.name ?? '', + }); + this.initialize(); + return this.innerApiCalls.moveAssignment(request, options, callback); + } +/** + * Updates an existing assignment. + * + * Only the `priority` field can be updated. + * + * @param {Object} request + * The request object that will be sent. + * @param {google.cloud.bigquery.reservation.v1.Assignment} request.assignment + * Content of the assignment to update. + * @param {google.protobuf.FieldMask} request.updateMask + * Standard field mask for the set of fields to be updated. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link google.cloud.bigquery.reservation.v1.Assignment | Assignment}. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) + * for more details and examples. + * @example include:samples/generated/v1/reservation_service.update_assignment.js + * region_tag:bigqueryreservation_v1_generated_ReservationService_UpdateAssignment_async + */ + updateAssignment( + request?: protos.google.cloud.bigquery.reservation.v1.IUpdateAssignmentRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.bigquery.reservation.v1.IAssignment, + protos.google.cloud.bigquery.reservation.v1.IUpdateAssignmentRequest|undefined, {}|undefined + ]>; + updateAssignment( + request: protos.google.cloud.bigquery.reservation.v1.IUpdateAssignmentRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.bigquery.reservation.v1.IAssignment, + protos.google.cloud.bigquery.reservation.v1.IUpdateAssignmentRequest|null|undefined, + {}|null|undefined>): void; + updateAssignment( + request: protos.google.cloud.bigquery.reservation.v1.IUpdateAssignmentRequest, + callback: Callback< + protos.google.cloud.bigquery.reservation.v1.IAssignment, + protos.google.cloud.bigquery.reservation.v1.IUpdateAssignmentRequest|null|undefined, + {}|null|undefined>): void; + updateAssignment( + request?: protos.google.cloud.bigquery.reservation.v1.IUpdateAssignmentRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.cloud.bigquery.reservation.v1.IAssignment, + protos.google.cloud.bigquery.reservation.v1.IUpdateAssignmentRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.cloud.bigquery.reservation.v1.IAssignment, + protos.google.cloud.bigquery.reservation.v1.IUpdateAssignmentRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.cloud.bigquery.reservation.v1.IAssignment, + protos.google.cloud.bigquery.reservation.v1.IUpdateAssignmentRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'assignment.name': request.assignment!.name ?? '', + }); + this.initialize(); + return this.innerApiCalls.updateAssignment(request, options, callback); + } +/** + * Retrieves a BI reservation. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. Name of the requested reservation, for example: + * `projects/{project_id}/locations/{location_id}/biReservation` + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link google.cloud.bigquery.reservation.v1.BiReservation | BiReservation}. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) + * for more details and examples. + * @example include:samples/generated/v1/reservation_service.get_bi_reservation.js + * region_tag:bigqueryreservation_v1_generated_ReservationService_GetBiReservation_async + */ + getBiReservation( + request?: protos.google.cloud.bigquery.reservation.v1.IGetBiReservationRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.bigquery.reservation.v1.IBiReservation, + protos.google.cloud.bigquery.reservation.v1.IGetBiReservationRequest|undefined, {}|undefined + ]>; + getBiReservation( + request: protos.google.cloud.bigquery.reservation.v1.IGetBiReservationRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.bigquery.reservation.v1.IBiReservation, + protos.google.cloud.bigquery.reservation.v1.IGetBiReservationRequest|null|undefined, + {}|null|undefined>): void; + getBiReservation( + request: protos.google.cloud.bigquery.reservation.v1.IGetBiReservationRequest, + callback: Callback< + protos.google.cloud.bigquery.reservation.v1.IBiReservation, + protos.google.cloud.bigquery.reservation.v1.IGetBiReservationRequest|null|undefined, + {}|null|undefined>): void; + getBiReservation( + request?: protos.google.cloud.bigquery.reservation.v1.IGetBiReservationRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.cloud.bigquery.reservation.v1.IBiReservation, + protos.google.cloud.bigquery.reservation.v1.IGetBiReservationRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.cloud.bigquery.reservation.v1.IBiReservation, + protos.google.cloud.bigquery.reservation.v1.IGetBiReservationRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.cloud.bigquery.reservation.v1.IBiReservation, + protos.google.cloud.bigquery.reservation.v1.IGetBiReservationRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'name': request.name ?? '', + }); + this.initialize(); + return this.innerApiCalls.getBiReservation(request, options, callback); + } +/** + * Updates a BI reservation. + * + * Only fields specified in the `field_mask` are updated. + * + * A singleton BI reservation always exists with default size 0. + * In order to reserve BI capacity it needs to be updated to an amount + * greater than 0. In order to release BI capacity reservation size + * must be set to 0. + * + * @param {Object} request + * The request object that will be sent. + * @param {google.cloud.bigquery.reservation.v1.BiReservation} request.biReservation + * A reservation to update. + * @param {google.protobuf.FieldMask} request.updateMask + * A list of fields to be updated in this request. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link google.cloud.bigquery.reservation.v1.BiReservation | BiReservation}. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) + * for more details and examples. + * @example include:samples/generated/v1/reservation_service.update_bi_reservation.js + * region_tag:bigqueryreservation_v1_generated_ReservationService_UpdateBiReservation_async + */ + updateBiReservation( + request?: protos.google.cloud.bigquery.reservation.v1.IUpdateBiReservationRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.bigquery.reservation.v1.IBiReservation, + protos.google.cloud.bigquery.reservation.v1.IUpdateBiReservationRequest|undefined, {}|undefined + ]>; + updateBiReservation( + request: protos.google.cloud.bigquery.reservation.v1.IUpdateBiReservationRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.bigquery.reservation.v1.IBiReservation, + protos.google.cloud.bigquery.reservation.v1.IUpdateBiReservationRequest|null|undefined, + {}|null|undefined>): void; + updateBiReservation( + request: protos.google.cloud.bigquery.reservation.v1.IUpdateBiReservationRequest, + callback: Callback< + protos.google.cloud.bigquery.reservation.v1.IBiReservation, + protos.google.cloud.bigquery.reservation.v1.IUpdateBiReservationRequest|null|undefined, + {}|null|undefined>): void; + updateBiReservation( + request?: protos.google.cloud.bigquery.reservation.v1.IUpdateBiReservationRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.cloud.bigquery.reservation.v1.IBiReservation, + protos.google.cloud.bigquery.reservation.v1.IUpdateBiReservationRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.cloud.bigquery.reservation.v1.IBiReservation, + protos.google.cloud.bigquery.reservation.v1.IUpdateBiReservationRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.cloud.bigquery.reservation.v1.IBiReservation, + protos.google.cloud.bigquery.reservation.v1.IUpdateBiReservationRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'bi_reservation.name': request.biReservation!.name ?? '', + }); + this.initialize(); + return this.innerApiCalls.updateBiReservation(request, options, callback); + } + + /** + * Lists all the reservations for the project in the specified location. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The parent resource name containing project and location, e.g.: + * `projects/myproject/locations/US` + * @param {number} request.pageSize + * The maximum number of items to return per page. + * @param {string} request.pageToken + * The next_page_token value returned from a previous List request, if any. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is Array of {@link google.cloud.bigquery.reservation.v1.Reservation | Reservation}. + * The client library will perform auto-pagination by default: it will call the API as many + * times as needed and will merge results from all the pages into this array. + * Note that it can affect your quota. + * We recommend using `listReservationsAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) + * for more details and examples. + */ + listReservations( + request?: protos.google.cloud.bigquery.reservation.v1.IListReservationsRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.bigquery.reservation.v1.IReservation[], + protos.google.cloud.bigquery.reservation.v1.IListReservationsRequest|null, + protos.google.cloud.bigquery.reservation.v1.IListReservationsResponse + ]>; + listReservations( + request: protos.google.cloud.bigquery.reservation.v1.IListReservationsRequest, + options: CallOptions, + callback: PaginationCallback< + protos.google.cloud.bigquery.reservation.v1.IListReservationsRequest, + protos.google.cloud.bigquery.reservation.v1.IListReservationsResponse|null|undefined, + protos.google.cloud.bigquery.reservation.v1.IReservation>): void; + listReservations( + request: protos.google.cloud.bigquery.reservation.v1.IListReservationsRequest, + callback: PaginationCallback< + protos.google.cloud.bigquery.reservation.v1.IListReservationsRequest, + protos.google.cloud.bigquery.reservation.v1.IListReservationsResponse|null|undefined, + protos.google.cloud.bigquery.reservation.v1.IReservation>): void; + listReservations( + request?: protos.google.cloud.bigquery.reservation.v1.IListReservationsRequest, + optionsOrCallback?: CallOptions|PaginationCallback< + protos.google.cloud.bigquery.reservation.v1.IListReservationsRequest, + protos.google.cloud.bigquery.reservation.v1.IListReservationsResponse|null|undefined, + protos.google.cloud.bigquery.reservation.v1.IReservation>, + callback?: PaginationCallback< + protos.google.cloud.bigquery.reservation.v1.IListReservationsRequest, + protos.google.cloud.bigquery.reservation.v1.IListReservationsResponse|null|undefined, + protos.google.cloud.bigquery.reservation.v1.IReservation>): + Promise<[ + protos.google.cloud.bigquery.reservation.v1.IReservation[], + protos.google.cloud.bigquery.reservation.v1.IListReservationsRequest|null, + protos.google.cloud.bigquery.reservation.v1.IListReservationsResponse + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'parent': request.parent ?? '', + }); + this.initialize(); + return this.innerApiCalls.listReservations(request, options, callback); + } + +/** + * Equivalent to `method.name.toCamelCase()`, but returns a NodeJS Stream object. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The parent resource name containing project and location, e.g.: + * `projects/myproject/locations/US` + * @param {number} request.pageSize + * The maximum number of items to return per page. + * @param {string} request.pageToken + * The next_page_token value returned from a previous List request, if any. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Stream} + * An object stream which emits an object representing {@link google.cloud.bigquery.reservation.v1.Reservation | Reservation} on 'data' event. + * The client library will perform auto-pagination by default: it will call the API as many + * times as needed. Note that it can affect your quota. + * We recommend using `listReservationsAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) + * for more details and examples. + */ + listReservationsStream( + request?: protos.google.cloud.bigquery.reservation.v1.IListReservationsRequest, + options?: CallOptions): + Transform{ + request = request || {}; + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'parent': request.parent ?? '', + }); + const defaultCallSettings = this._defaults['listReservations']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.listReservations.createStream( + this.innerApiCalls.listReservations as GaxCall, + request, + callSettings + ); + } + +/** + * Equivalent to `listReservations`, but returns an iterable object. + * + * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The parent resource name containing project and location, e.g.: + * `projects/myproject/locations/US` + * @param {number} request.pageSize + * The maximum number of items to return per page. + * @param {string} request.pageToken + * The next_page_token value returned from a previous List request, if any. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Object} + * An iterable Object that allows [async iteration](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols). + * When you iterate the returned iterable, each element will be an object representing + * {@link google.cloud.bigquery.reservation.v1.Reservation | Reservation}. The API will be called under the hood as needed, once per the page, + * so you can stop the iteration when you don't need more results. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) + * for more details and examples. + * @example include:samples/generated/v1/reservation_service.list_reservations.js + * region_tag:bigqueryreservation_v1_generated_ReservationService_ListReservations_async + */ + listReservationsAsync( + request?: protos.google.cloud.bigquery.reservation.v1.IListReservationsRequest, + options?: CallOptions): + AsyncIterable{ + request = request || {}; + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'parent': request.parent ?? '', + }); + const defaultCallSettings = this._defaults['listReservations']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.listReservations.asyncIterate( + this.innerApiCalls['listReservations'] as GaxCall, + request as {}, + callSettings + ) as AsyncIterable; + } + /** + * Lists all the capacity commitments for the admin project. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. Resource name of the parent reservation. E.g., + * `projects/myproject/locations/US` + * @param {number} request.pageSize + * The maximum number of items to return. + * @param {string} request.pageToken + * The next_page_token value returned from a previous List request, if any. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is Array of {@link google.cloud.bigquery.reservation.v1.CapacityCommitment | CapacityCommitment}. + * The client library will perform auto-pagination by default: it will call the API as many + * times as needed and will merge results from all the pages into this array. + * Note that it can affect your quota. + * We recommend using `listCapacityCommitmentsAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) + * for more details and examples. + */ + listCapacityCommitments( + request?: protos.google.cloud.bigquery.reservation.v1.IListCapacityCommitmentsRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.bigquery.reservation.v1.ICapacityCommitment[], + protos.google.cloud.bigquery.reservation.v1.IListCapacityCommitmentsRequest|null, + protos.google.cloud.bigquery.reservation.v1.IListCapacityCommitmentsResponse + ]>; + listCapacityCommitments( + request: protos.google.cloud.bigquery.reservation.v1.IListCapacityCommitmentsRequest, + options: CallOptions, + callback: PaginationCallback< + protos.google.cloud.bigquery.reservation.v1.IListCapacityCommitmentsRequest, + protos.google.cloud.bigquery.reservation.v1.IListCapacityCommitmentsResponse|null|undefined, + protos.google.cloud.bigquery.reservation.v1.ICapacityCommitment>): void; + listCapacityCommitments( + request: protos.google.cloud.bigquery.reservation.v1.IListCapacityCommitmentsRequest, + callback: PaginationCallback< + protos.google.cloud.bigquery.reservation.v1.IListCapacityCommitmentsRequest, + protos.google.cloud.bigquery.reservation.v1.IListCapacityCommitmentsResponse|null|undefined, + protos.google.cloud.bigquery.reservation.v1.ICapacityCommitment>): void; + listCapacityCommitments( + request?: protos.google.cloud.bigquery.reservation.v1.IListCapacityCommitmentsRequest, + optionsOrCallback?: CallOptions|PaginationCallback< + protos.google.cloud.bigquery.reservation.v1.IListCapacityCommitmentsRequest, + protos.google.cloud.bigquery.reservation.v1.IListCapacityCommitmentsResponse|null|undefined, + protos.google.cloud.bigquery.reservation.v1.ICapacityCommitment>, + callback?: PaginationCallback< + protos.google.cloud.bigquery.reservation.v1.IListCapacityCommitmentsRequest, + protos.google.cloud.bigquery.reservation.v1.IListCapacityCommitmentsResponse|null|undefined, + protos.google.cloud.bigquery.reservation.v1.ICapacityCommitment>): + Promise<[ + protos.google.cloud.bigquery.reservation.v1.ICapacityCommitment[], + protos.google.cloud.bigquery.reservation.v1.IListCapacityCommitmentsRequest|null, + protos.google.cloud.bigquery.reservation.v1.IListCapacityCommitmentsResponse + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'parent': request.parent ?? '', + }); + this.initialize(); + return this.innerApiCalls.listCapacityCommitments(request, options, callback); + } + +/** + * Equivalent to `method.name.toCamelCase()`, but returns a NodeJS Stream object. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. Resource name of the parent reservation. E.g., + * `projects/myproject/locations/US` + * @param {number} request.pageSize + * The maximum number of items to return. + * @param {string} request.pageToken + * The next_page_token value returned from a previous List request, if any. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Stream} + * An object stream which emits an object representing {@link google.cloud.bigquery.reservation.v1.CapacityCommitment | CapacityCommitment} on 'data' event. + * The client library will perform auto-pagination by default: it will call the API as many + * times as needed. Note that it can affect your quota. + * We recommend using `listCapacityCommitmentsAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) + * for more details and examples. + */ + listCapacityCommitmentsStream( + request?: protos.google.cloud.bigquery.reservation.v1.IListCapacityCommitmentsRequest, + options?: CallOptions): + Transform{ + request = request || {}; + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'parent': request.parent ?? '', + }); + const defaultCallSettings = this._defaults['listCapacityCommitments']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.listCapacityCommitments.createStream( + this.innerApiCalls.listCapacityCommitments as GaxCall, + request, + callSettings + ); + } + +/** + * Equivalent to `listCapacityCommitments`, but returns an iterable object. + * + * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. Resource name of the parent reservation. E.g., + * `projects/myproject/locations/US` + * @param {number} request.pageSize + * The maximum number of items to return. + * @param {string} request.pageToken + * The next_page_token value returned from a previous List request, if any. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Object} + * An iterable Object that allows [async iteration](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols). + * When you iterate the returned iterable, each element will be an object representing + * {@link google.cloud.bigquery.reservation.v1.CapacityCommitment | CapacityCommitment}. The API will be called under the hood as needed, once per the page, + * so you can stop the iteration when you don't need more results. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) + * for more details and examples. + * @example include:samples/generated/v1/reservation_service.list_capacity_commitments.js + * region_tag:bigqueryreservation_v1_generated_ReservationService_ListCapacityCommitments_async + */ + listCapacityCommitmentsAsync( + request?: protos.google.cloud.bigquery.reservation.v1.IListCapacityCommitmentsRequest, + options?: CallOptions): + AsyncIterable{ + request = request || {}; + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'parent': request.parent ?? '', + }); + const defaultCallSettings = this._defaults['listCapacityCommitments']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.listCapacityCommitments.asyncIterate( + this.innerApiCalls['listCapacityCommitments'] as GaxCall, + request as {}, + callSettings + ) as AsyncIterable; + } + /** + * Lists assignments. + * + * Only explicitly created assignments will be returned. + * + * Example: + * + * * Organization `organizationA` contains two projects, `project1` and + * `project2`. + * * Reservation `res1` exists and was created previously. + * * CreateAssignment was used previously to define the following + * associations between entities and reservations: `` + * and `` + * + * In this example, ListAssignments will just return the above two assignments + * for reservation `res1`, and no expansion/merge will happen. + * + * The wildcard "-" can be used for + * reservations in the request. In that case all assignments belongs to the + * specified project and location will be listed. + * + * **Note** "-" cannot be used for projects nor locations. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The parent resource name e.g.: + * + * `projects/myproject/locations/US/reservations/team1-prod` + * + * Or: + * + * `projects/myproject/locations/US/reservations/-` + * @param {number} request.pageSize + * The maximum number of items to return per page. + * @param {string} request.pageToken + * The next_page_token value returned from a previous List request, if any. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is Array of {@link google.cloud.bigquery.reservation.v1.Assignment | Assignment}. + * The client library will perform auto-pagination by default: it will call the API as many + * times as needed and will merge results from all the pages into this array. + * Note that it can affect your quota. + * We recommend using `listAssignmentsAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) + * for more details and examples. + */ + listAssignments( + request?: protos.google.cloud.bigquery.reservation.v1.IListAssignmentsRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.bigquery.reservation.v1.IAssignment[], + protos.google.cloud.bigquery.reservation.v1.IListAssignmentsRequest|null, + protos.google.cloud.bigquery.reservation.v1.IListAssignmentsResponse + ]>; + listAssignments( + request: protos.google.cloud.bigquery.reservation.v1.IListAssignmentsRequest, + options: CallOptions, + callback: PaginationCallback< + protos.google.cloud.bigquery.reservation.v1.IListAssignmentsRequest, + protos.google.cloud.bigquery.reservation.v1.IListAssignmentsResponse|null|undefined, + protos.google.cloud.bigquery.reservation.v1.IAssignment>): void; + listAssignments( + request: protos.google.cloud.bigquery.reservation.v1.IListAssignmentsRequest, + callback: PaginationCallback< + protos.google.cloud.bigquery.reservation.v1.IListAssignmentsRequest, + protos.google.cloud.bigquery.reservation.v1.IListAssignmentsResponse|null|undefined, + protos.google.cloud.bigquery.reservation.v1.IAssignment>): void; + listAssignments( + request?: protos.google.cloud.bigquery.reservation.v1.IListAssignmentsRequest, + optionsOrCallback?: CallOptions|PaginationCallback< + protos.google.cloud.bigquery.reservation.v1.IListAssignmentsRequest, + protos.google.cloud.bigquery.reservation.v1.IListAssignmentsResponse|null|undefined, + protos.google.cloud.bigquery.reservation.v1.IAssignment>, + callback?: PaginationCallback< + protos.google.cloud.bigquery.reservation.v1.IListAssignmentsRequest, + protos.google.cloud.bigquery.reservation.v1.IListAssignmentsResponse|null|undefined, + protos.google.cloud.bigquery.reservation.v1.IAssignment>): + Promise<[ + protos.google.cloud.bigquery.reservation.v1.IAssignment[], + protos.google.cloud.bigquery.reservation.v1.IListAssignmentsRequest|null, + protos.google.cloud.bigquery.reservation.v1.IListAssignmentsResponse + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'parent': request.parent ?? '', + }); + this.initialize(); + return this.innerApiCalls.listAssignments(request, options, callback); + } + +/** + * Equivalent to `method.name.toCamelCase()`, but returns a NodeJS Stream object. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The parent resource name e.g.: + * + * `projects/myproject/locations/US/reservations/team1-prod` + * + * Or: + * + * `projects/myproject/locations/US/reservations/-` + * @param {number} request.pageSize + * The maximum number of items to return per page. + * @param {string} request.pageToken + * The next_page_token value returned from a previous List request, if any. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Stream} + * An object stream which emits an object representing {@link google.cloud.bigquery.reservation.v1.Assignment | Assignment} on 'data' event. + * The client library will perform auto-pagination by default: it will call the API as many + * times as needed. Note that it can affect your quota. + * We recommend using `listAssignmentsAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) + * for more details and examples. + */ + listAssignmentsStream( + request?: protos.google.cloud.bigquery.reservation.v1.IListAssignmentsRequest, + options?: CallOptions): + Transform{ + request = request || {}; + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'parent': request.parent ?? '', + }); + const defaultCallSettings = this._defaults['listAssignments']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.listAssignments.createStream( + this.innerApiCalls.listAssignments as GaxCall, + request, + callSettings + ); + } + +/** + * Equivalent to `listAssignments`, but returns an iterable object. + * + * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The parent resource name e.g.: + * + * `projects/myproject/locations/US/reservations/team1-prod` + * + * Or: + * + * `projects/myproject/locations/US/reservations/-` + * @param {number} request.pageSize + * The maximum number of items to return per page. + * @param {string} request.pageToken + * The next_page_token value returned from a previous List request, if any. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Object} + * An iterable Object that allows [async iteration](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols). + * When you iterate the returned iterable, each element will be an object representing + * {@link google.cloud.bigquery.reservation.v1.Assignment | Assignment}. The API will be called under the hood as needed, once per the page, + * so you can stop the iteration when you don't need more results. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) + * for more details and examples. + * @example include:samples/generated/v1/reservation_service.list_assignments.js + * region_tag:bigqueryreservation_v1_generated_ReservationService_ListAssignments_async + */ + listAssignmentsAsync( + request?: protos.google.cloud.bigquery.reservation.v1.IListAssignmentsRequest, + options?: CallOptions): + AsyncIterable{ + request = request || {}; + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'parent': request.parent ?? '', + }); + const defaultCallSettings = this._defaults['listAssignments']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.listAssignments.asyncIterate( + this.innerApiCalls['listAssignments'] as GaxCall, + request as {}, + callSettings + ) as AsyncIterable; + } + /** + * Deprecated: Looks up assignments for a specified resource for a particular + * region. If the request is about a project: + * + * 1. Assignments created on the project will be returned if they exist. + * 2. Otherwise assignments created on the closest ancestor will be + * returned. + * 3. Assignments for different JobTypes will all be returned. + * + * The same logic applies if the request is about a folder. + * + * If the request is about an organization, then assignments created on the + * organization will be returned (organization doesn't have ancestors). + * + * Comparing to ListAssignments, there are some behavior + * differences: + * + * 1. permission on the assignee will be verified in this API. + * 2. Hierarchy lookup (project->folder->organization) happens in this API. + * 3. Parent here is `projects/* /locations/*`, instead of + * `projects/* /locations/*reservations/*`. + * + * **Note** "-" cannot be used for projects + * nor locations. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The resource name of the admin project(containing project and + * location), e.g.: + * `projects/myproject/locations/US`. + * @param {string} request.query + * Please specify resource name as assignee in the query. + * + * Examples: + * + * * `assignee=projects/myproject` + * * `assignee=folders/123` + * * `assignee=organizations/456` + * @param {number} request.pageSize + * The maximum number of items to return per page. + * @param {string} request.pageToken + * The next_page_token value returned from a previous List request, if any. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is Array of {@link google.cloud.bigquery.reservation.v1.Assignment | Assignment}. + * The client library will perform auto-pagination by default: it will call the API as many + * times as needed and will merge results from all the pages into this array. + * Note that it can affect your quota. + * We recommend using `searchAssignmentsAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) + * for more details and examples. + * @deprecated SearchAssignments is deprecated and may be removed in a future version. + */ + searchAssignments( + request?: protos.google.cloud.bigquery.reservation.v1.ISearchAssignmentsRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.bigquery.reservation.v1.IAssignment[], + protos.google.cloud.bigquery.reservation.v1.ISearchAssignmentsRequest|null, + protos.google.cloud.bigquery.reservation.v1.ISearchAssignmentsResponse + ]>; + searchAssignments( + request: protos.google.cloud.bigquery.reservation.v1.ISearchAssignmentsRequest, + options: CallOptions, + callback: PaginationCallback< + protos.google.cloud.bigquery.reservation.v1.ISearchAssignmentsRequest, + protos.google.cloud.bigquery.reservation.v1.ISearchAssignmentsResponse|null|undefined, + protos.google.cloud.bigquery.reservation.v1.IAssignment>): void; + searchAssignments( + request: protos.google.cloud.bigquery.reservation.v1.ISearchAssignmentsRequest, + callback: PaginationCallback< + protos.google.cloud.bigquery.reservation.v1.ISearchAssignmentsRequest, + protos.google.cloud.bigquery.reservation.v1.ISearchAssignmentsResponse|null|undefined, + protos.google.cloud.bigquery.reservation.v1.IAssignment>): void; + searchAssignments( + request?: protos.google.cloud.bigquery.reservation.v1.ISearchAssignmentsRequest, + optionsOrCallback?: CallOptions|PaginationCallback< + protos.google.cloud.bigquery.reservation.v1.ISearchAssignmentsRequest, + protos.google.cloud.bigquery.reservation.v1.ISearchAssignmentsResponse|null|undefined, + protos.google.cloud.bigquery.reservation.v1.IAssignment>, + callback?: PaginationCallback< + protos.google.cloud.bigquery.reservation.v1.ISearchAssignmentsRequest, + protos.google.cloud.bigquery.reservation.v1.ISearchAssignmentsResponse|null|undefined, + protos.google.cloud.bigquery.reservation.v1.IAssignment>): + Promise<[ + protos.google.cloud.bigquery.reservation.v1.IAssignment[], + protos.google.cloud.bigquery.reservation.v1.ISearchAssignmentsRequest|null, + protos.google.cloud.bigquery.reservation.v1.ISearchAssignmentsResponse + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'parent': request.parent ?? '', + }); + this.initialize(); + this.warn('DEP$ReservationService-$SearchAssignments','SearchAssignments is deprecated and may be removed in a future version.', 'DeprecationWarning'); + return this.innerApiCalls.searchAssignments(request, options, callback); + } + +/** + * Equivalent to `method.name.toCamelCase()`, but returns a NodeJS Stream object. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The resource name of the admin project(containing project and + * location), e.g.: + * `projects/myproject/locations/US`. + * @param {string} request.query + * Please specify resource name as assignee in the query. + * + * Examples: + * + * * `assignee=projects/myproject` + * * `assignee=folders/123` + * * `assignee=organizations/456` + * @param {number} request.pageSize + * The maximum number of items to return per page. + * @param {string} request.pageToken + * The next_page_token value returned from a previous List request, if any. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Stream} + * An object stream which emits an object representing {@link google.cloud.bigquery.reservation.v1.Assignment | Assignment} on 'data' event. + * The client library will perform auto-pagination by default: it will call the API as many + * times as needed. Note that it can affect your quota. + * We recommend using `searchAssignmentsAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) + * for more details and examples. + * @deprecated SearchAssignments is deprecated and may be removed in a future version. + */ + searchAssignmentsStream( + request?: protos.google.cloud.bigquery.reservation.v1.ISearchAssignmentsRequest, + options?: CallOptions): + Transform{ + request = request || {}; + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'parent': request.parent ?? '', + }); + const defaultCallSettings = this._defaults['searchAssignments']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + this.warn('DEP$ReservationService-$SearchAssignments','SearchAssignments is deprecated and may be removed in a future version.', 'DeprecationWarning'); + return this.descriptors.page.searchAssignments.createStream( + this.innerApiCalls.searchAssignments as GaxCall, + request, + callSettings + ); + } + +/** + * Equivalent to `searchAssignments`, but returns an iterable object. + * + * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The resource name of the admin project(containing project and + * location), e.g.: + * `projects/myproject/locations/US`. + * @param {string} request.query + * Please specify resource name as assignee in the query. + * + * Examples: + * + * * `assignee=projects/myproject` + * * `assignee=folders/123` + * * `assignee=organizations/456` + * @param {number} request.pageSize + * The maximum number of items to return per page. + * @param {string} request.pageToken + * The next_page_token value returned from a previous List request, if any. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Object} + * An iterable Object that allows [async iteration](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols). + * When you iterate the returned iterable, each element will be an object representing + * {@link google.cloud.bigquery.reservation.v1.Assignment | Assignment}. The API will be called under the hood as needed, once per the page, + * so you can stop the iteration when you don't need more results. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) + * for more details and examples. + * @example include:samples/generated/v1/reservation_service.search_assignments.js + * region_tag:bigqueryreservation_v1_generated_ReservationService_SearchAssignments_async + * @deprecated SearchAssignments is deprecated and may be removed in a future version. + */ + searchAssignmentsAsync( + request?: protos.google.cloud.bigquery.reservation.v1.ISearchAssignmentsRequest, + options?: CallOptions): + AsyncIterable{ + request = request || {}; + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'parent': request.parent ?? '', + }); + const defaultCallSettings = this._defaults['searchAssignments']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + this.warn('DEP$ReservationService-$SearchAssignments','SearchAssignments is deprecated and may be removed in a future version.', 'DeprecationWarning'); + return this.descriptors.page.searchAssignments.asyncIterate( + this.innerApiCalls['searchAssignments'] as GaxCall, + request as {}, + callSettings + ) as AsyncIterable; + } + /** + * Looks up assignments for a specified resource for a particular region. + * If the request is about a project: + * + * 1. Assignments created on the project will be returned if they exist. + * 2. Otherwise assignments created on the closest ancestor will be + * returned. + * 3. Assignments for different JobTypes will all be returned. + * + * The same logic applies if the request is about a folder. + * + * If the request is about an organization, then assignments created on the + * organization will be returned (organization doesn't have ancestors). + * + * Comparing to ListAssignments, there are some behavior + * differences: + * + * 1. permission on the assignee will be verified in this API. + * 2. Hierarchy lookup (project->folder->organization) happens in this API. + * 3. Parent here is `projects/* /locations/*`, instead of + * `projects/* /locations/*reservations/*`. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The resource name with location (project name could be the + * wildcard '-'), e.g.: + * `projects/-/locations/US`. + * @param {string} request.query + * Please specify resource name as assignee in the query. + * + * Examples: + * + * * `assignee=projects/myproject` + * * `assignee=folders/123` + * * `assignee=organizations/456` + * @param {number} request.pageSize + * The maximum number of items to return per page. + * @param {string} request.pageToken + * The next_page_token value returned from a previous List request, if any. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is Array of {@link google.cloud.bigquery.reservation.v1.Assignment | Assignment}. + * The client library will perform auto-pagination by default: it will call the API as many + * times as needed and will merge results from all the pages into this array. + * Note that it can affect your quota. + * We recommend using `searchAllAssignmentsAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) + * for more details and examples. + */ + searchAllAssignments( + request?: protos.google.cloud.bigquery.reservation.v1.ISearchAllAssignmentsRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.bigquery.reservation.v1.IAssignment[], + protos.google.cloud.bigquery.reservation.v1.ISearchAllAssignmentsRequest|null, + protos.google.cloud.bigquery.reservation.v1.ISearchAllAssignmentsResponse + ]>; + searchAllAssignments( + request: protos.google.cloud.bigquery.reservation.v1.ISearchAllAssignmentsRequest, + options: CallOptions, + callback: PaginationCallback< + protos.google.cloud.bigquery.reservation.v1.ISearchAllAssignmentsRequest, + protos.google.cloud.bigquery.reservation.v1.ISearchAllAssignmentsResponse|null|undefined, + protos.google.cloud.bigquery.reservation.v1.IAssignment>): void; + searchAllAssignments( + request: protos.google.cloud.bigquery.reservation.v1.ISearchAllAssignmentsRequest, + callback: PaginationCallback< + protos.google.cloud.bigquery.reservation.v1.ISearchAllAssignmentsRequest, + protos.google.cloud.bigquery.reservation.v1.ISearchAllAssignmentsResponse|null|undefined, + protos.google.cloud.bigquery.reservation.v1.IAssignment>): void; + searchAllAssignments( + request?: protos.google.cloud.bigquery.reservation.v1.ISearchAllAssignmentsRequest, + optionsOrCallback?: CallOptions|PaginationCallback< + protos.google.cloud.bigquery.reservation.v1.ISearchAllAssignmentsRequest, + protos.google.cloud.bigquery.reservation.v1.ISearchAllAssignmentsResponse|null|undefined, + protos.google.cloud.bigquery.reservation.v1.IAssignment>, + callback?: PaginationCallback< + protos.google.cloud.bigquery.reservation.v1.ISearchAllAssignmentsRequest, + protos.google.cloud.bigquery.reservation.v1.ISearchAllAssignmentsResponse|null|undefined, + protos.google.cloud.bigquery.reservation.v1.IAssignment>): + Promise<[ + protos.google.cloud.bigquery.reservation.v1.IAssignment[], + protos.google.cloud.bigquery.reservation.v1.ISearchAllAssignmentsRequest|null, + protos.google.cloud.bigquery.reservation.v1.ISearchAllAssignmentsResponse + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'parent': request.parent ?? '', + }); + this.initialize(); + return this.innerApiCalls.searchAllAssignments(request, options, callback); + } + +/** + * Equivalent to `method.name.toCamelCase()`, but returns a NodeJS Stream object. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The resource name with location (project name could be the + * wildcard '-'), e.g.: + * `projects/-/locations/US`. + * @param {string} request.query + * Please specify resource name as assignee in the query. + * + * Examples: + * + * * `assignee=projects/myproject` + * * `assignee=folders/123` + * * `assignee=organizations/456` + * @param {number} request.pageSize + * The maximum number of items to return per page. + * @param {string} request.pageToken + * The next_page_token value returned from a previous List request, if any. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Stream} + * An object stream which emits an object representing {@link google.cloud.bigquery.reservation.v1.Assignment | Assignment} on 'data' event. + * The client library will perform auto-pagination by default: it will call the API as many + * times as needed. Note that it can affect your quota. + * We recommend using `searchAllAssignmentsAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) + * for more details and examples. + */ + searchAllAssignmentsStream( + request?: protos.google.cloud.bigquery.reservation.v1.ISearchAllAssignmentsRequest, + options?: CallOptions): + Transform{ + request = request || {}; + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'parent': request.parent ?? '', + }); + const defaultCallSettings = this._defaults['searchAllAssignments']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.searchAllAssignments.createStream( + this.innerApiCalls.searchAllAssignments as GaxCall, + request, + callSettings + ); + } + +/** + * Equivalent to `searchAllAssignments`, but returns an iterable object. + * + * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The resource name with location (project name could be the + * wildcard '-'), e.g.: + * `projects/-/locations/US`. + * @param {string} request.query + * Please specify resource name as assignee in the query. + * + * Examples: + * + * * `assignee=projects/myproject` + * * `assignee=folders/123` + * * `assignee=organizations/456` + * @param {number} request.pageSize + * The maximum number of items to return per page. + * @param {string} request.pageToken + * The next_page_token value returned from a previous List request, if any. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Object} + * An iterable Object that allows [async iteration](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols). + * When you iterate the returned iterable, each element will be an object representing + * {@link google.cloud.bigquery.reservation.v1.Assignment | Assignment}. The API will be called under the hood as needed, once per the page, + * so you can stop the iteration when you don't need more results. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) + * for more details and examples. + * @example include:samples/generated/v1/reservation_service.search_all_assignments.js + * region_tag:bigqueryreservation_v1_generated_ReservationService_SearchAllAssignments_async + */ + searchAllAssignmentsAsync( + request?: protos.google.cloud.bigquery.reservation.v1.ISearchAllAssignmentsRequest, + options?: CallOptions): + AsyncIterable{ + request = request || {}; + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'parent': request.parent ?? '', + }); + const defaultCallSettings = this._defaults['searchAllAssignments']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.searchAllAssignments.asyncIterate( + this.innerApiCalls['searchAllAssignments'] as GaxCall, + request as {}, + callSettings + ) as AsyncIterable; + } + // -------------------- + // -- Path templates -- + // -------------------- + + /** + * Return a fully-qualified assignment resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} reservation + * @param {string} assignment + * @returns {string} Resource name string. + */ + assignmentPath(project:string,location:string,reservation:string,assignment:string) { + return this.pathTemplates.assignmentPathTemplate.render({ + project: project, + location: location, + reservation: reservation, + assignment: assignment, + }); + } + + /** + * Parse the project from Assignment resource. + * + * @param {string} assignmentName + * A fully-qualified path representing Assignment resource. + * @returns {string} A string representing the project. + */ + matchProjectFromAssignmentName(assignmentName: string) { + return this.pathTemplates.assignmentPathTemplate.match(assignmentName).project; + } + + /** + * Parse the location from Assignment resource. + * + * @param {string} assignmentName + * A fully-qualified path representing Assignment resource. + * @returns {string} A string representing the location. + */ + matchLocationFromAssignmentName(assignmentName: string) { + return this.pathTemplates.assignmentPathTemplate.match(assignmentName).location; + } + + /** + * Parse the reservation from Assignment resource. + * + * @param {string} assignmentName + * A fully-qualified path representing Assignment resource. + * @returns {string} A string representing the reservation. + */ + matchReservationFromAssignmentName(assignmentName: string) { + return this.pathTemplates.assignmentPathTemplate.match(assignmentName).reservation; + } + + /** + * Parse the assignment from Assignment resource. + * + * @param {string} assignmentName + * A fully-qualified path representing Assignment resource. + * @returns {string} A string representing the assignment. + */ + matchAssignmentFromAssignmentName(assignmentName: string) { + return this.pathTemplates.assignmentPathTemplate.match(assignmentName).assignment; + } + + /** + * Return a fully-qualified biReservation resource name string. + * + * @param {string} project + * @param {string} location + * @returns {string} Resource name string. + */ + biReservationPath(project:string,location:string) { + return this.pathTemplates.biReservationPathTemplate.render({ + project: project, + location: location, + }); + } + + /** + * Parse the project from BiReservation resource. + * + * @param {string} biReservationName + * A fully-qualified path representing BiReservation resource. + * @returns {string} A string representing the project. + */ + matchProjectFromBiReservationName(biReservationName: string) { + return this.pathTemplates.biReservationPathTemplate.match(biReservationName).project; + } + + /** + * Parse the location from BiReservation resource. + * + * @param {string} biReservationName + * A fully-qualified path representing BiReservation resource. + * @returns {string} A string representing the location. + */ + matchLocationFromBiReservationName(biReservationName: string) { + return this.pathTemplates.biReservationPathTemplate.match(biReservationName).location; + } + + /** + * Return a fully-qualified capacityCommitment resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} capacity_commitment + * @returns {string} Resource name string. + */ + capacityCommitmentPath(project:string,location:string,capacityCommitment:string) { + return this.pathTemplates.capacityCommitmentPathTemplate.render({ + project: project, + location: location, + capacity_commitment: capacityCommitment, + }); + } + + /** + * Parse the project from CapacityCommitment resource. + * + * @param {string} capacityCommitmentName + * A fully-qualified path representing CapacityCommitment resource. + * @returns {string} A string representing the project. + */ + matchProjectFromCapacityCommitmentName(capacityCommitmentName: string) { + return this.pathTemplates.capacityCommitmentPathTemplate.match(capacityCommitmentName).project; + } + + /** + * Parse the location from CapacityCommitment resource. + * + * @param {string} capacityCommitmentName + * A fully-qualified path representing CapacityCommitment resource. + * @returns {string} A string representing the location. + */ + matchLocationFromCapacityCommitmentName(capacityCommitmentName: string) { + return this.pathTemplates.capacityCommitmentPathTemplate.match(capacityCommitmentName).location; + } + + /** + * Parse the capacity_commitment from CapacityCommitment resource. + * + * @param {string} capacityCommitmentName + * A fully-qualified path representing CapacityCommitment resource. + * @returns {string} A string representing the capacity_commitment. + */ + matchCapacityCommitmentFromCapacityCommitmentName(capacityCommitmentName: string) { + return this.pathTemplates.capacityCommitmentPathTemplate.match(capacityCommitmentName).capacity_commitment; + } + + /** + * Return a fully-qualified location resource name string. + * + * @param {string} project + * @param {string} location + * @returns {string} Resource name string. + */ + locationPath(project:string,location:string) { + return this.pathTemplates.locationPathTemplate.render({ + project: project, + location: location, + }); + } + + /** + * Parse the project from Location resource. + * + * @param {string} locationName + * A fully-qualified path representing Location resource. + * @returns {string} A string representing the project. + */ + matchProjectFromLocationName(locationName: string) { + return this.pathTemplates.locationPathTemplate.match(locationName).project; + } + + /** + * Parse the location from Location resource. + * + * @param {string} locationName + * A fully-qualified path representing Location resource. + * @returns {string} A string representing the location. + */ + matchLocationFromLocationName(locationName: string) { + return this.pathTemplates.locationPathTemplate.match(locationName).location; + } + + /** + * Return a fully-qualified project resource name string. + * + * @param {string} project + * @returns {string} Resource name string. + */ + projectPath(project:string) { + return this.pathTemplates.projectPathTemplate.render({ + project: project, + }); + } + + /** + * Parse the project from Project resource. + * + * @param {string} projectName + * A fully-qualified path representing Project resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectName(projectName: string) { + return this.pathTemplates.projectPathTemplate.match(projectName).project; + } + + /** + * Return a fully-qualified reservation resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} reservation + * @returns {string} Resource name string. + */ + reservationPath(project:string,location:string,reservation:string) { + return this.pathTemplates.reservationPathTemplate.render({ + project: project, + location: location, + reservation: reservation, + }); + } + + /** + * Parse the project from Reservation resource. + * + * @param {string} reservationName + * A fully-qualified path representing Reservation resource. + * @returns {string} A string representing the project. + */ + matchProjectFromReservationName(reservationName: string) { + return this.pathTemplates.reservationPathTemplate.match(reservationName).project; + } + + /** + * Parse the location from Reservation resource. + * + * @param {string} reservationName + * A fully-qualified path representing Reservation resource. + * @returns {string} A string representing the location. + */ + matchLocationFromReservationName(reservationName: string) { + return this.pathTemplates.reservationPathTemplate.match(reservationName).location; + } + + /** + * Parse the reservation from Reservation resource. + * + * @param {string} reservationName + * A fully-qualified path representing Reservation resource. + * @returns {string} A string representing the reservation. + */ + matchReservationFromReservationName(reservationName: string) { + return this.pathTemplates.reservationPathTemplate.match(reservationName).reservation; + } + + /** + * Terminate the gRPC channel and close the client. + * + * The client will no longer be usable and all future behavior is undefined. + * @returns {Promise} A promise that resolves when the client is closed. + */ + close(): Promise { + if (this.reservationServiceStub && !this._terminated) { + return this.reservationServiceStub.then(stub => { + this._terminated = true; + stub.close(); + }); + } + return Promise.resolve(); + } +} diff --git a/owl-bot-staging/google-cloud-bigquery-reservation/v1/src/v1/reservation_service_client_config.json b/owl-bot-staging/google-cloud-bigquery-reservation/v1/src/v1/reservation_service_client_config.json new file mode 100644 index 00000000000..2ac442ba027 --- /dev/null +++ b/owl-bot-staging/google-cloud-bigquery-reservation/v1/src/v1/reservation_service_client_config.json @@ -0,0 +1,129 @@ +{ + "interfaces": { + "google.cloud.bigquery.reservation.v1.ReservationService": { + "retry_codes": { + "non_idempotent": [], + "idempotent": [ + "DEADLINE_EXCEEDED", + "UNAVAILABLE" + ] + }, + "retry_params": { + "default": { + "initial_retry_delay_millis": 100, + "retry_delay_multiplier": 1.3, + "max_retry_delay_millis": 60000, + "initial_rpc_timeout_millis": 60000, + "rpc_timeout_multiplier": 1, + "max_rpc_timeout_millis": 60000, + "total_timeout_millis": 600000 + } + }, + "methods": { + "CreateReservation": { + "timeout_millis": 300000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "ListReservations": { + "timeout_millis": 300000, + "retry_codes_name": "idempotent", + "retry_params_name": "default" + }, + "GetReservation": { + "timeout_millis": 300000, + "retry_codes_name": "idempotent", + "retry_params_name": "default" + }, + "DeleteReservation": { + "timeout_millis": 300000, + "retry_codes_name": "idempotent", + "retry_params_name": "default" + }, + "UpdateReservation": { + "timeout_millis": 300000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "CreateCapacityCommitment": { + "timeout_millis": 300000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "ListCapacityCommitments": { + "timeout_millis": 300000, + "retry_codes_name": "idempotent", + "retry_params_name": "default" + }, + "GetCapacityCommitment": { + "timeout_millis": 300000, + "retry_codes_name": "idempotent", + "retry_params_name": "default" + }, + "DeleteCapacityCommitment": { + "timeout_millis": 300000, + "retry_codes_name": "idempotent", + "retry_params_name": "default" + }, + "UpdateCapacityCommitment": { + "timeout_millis": 300000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "SplitCapacityCommitment": { + "timeout_millis": 300000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "MergeCapacityCommitments": { + "timeout_millis": 300000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "CreateAssignment": { + "timeout_millis": 300000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "ListAssignments": { + "timeout_millis": 300000, + "retry_codes_name": "idempotent", + "retry_params_name": "default" + }, + "DeleteAssignment": { + "timeout_millis": 300000, + "retry_codes_name": "idempotent", + "retry_params_name": "default" + }, + "SearchAssignments": { + "timeout_millis": 300000, + "retry_codes_name": "idempotent", + "retry_params_name": "default" + }, + "SearchAllAssignments": { + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "MoveAssignment": { + "timeout_millis": 300000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "UpdateAssignment": { + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "GetBiReservation": { + "timeout_millis": 300000, + "retry_codes_name": "idempotent", + "retry_params_name": "default" + }, + "UpdateBiReservation": { + "timeout_millis": 300000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + } + } + } + } +} diff --git a/owl-bot-staging/google-cloud-bigquery-reservation/v1/src/v1/reservation_service_proto_list.json b/owl-bot-staging/google-cloud-bigquery-reservation/v1/src/v1/reservation_service_proto_list.json new file mode 100644 index 00000000000..8746e8df5c9 --- /dev/null +++ b/owl-bot-staging/google-cloud-bigquery-reservation/v1/src/v1/reservation_service_proto_list.json @@ -0,0 +1,3 @@ +[ + "../../protos/google/cloud/bigquery/reservation/v1/reservation.proto" +] diff --git a/owl-bot-staging/google-cloud-bigquery-reservation/v1/system-test/fixtures/sample/src/index.js b/owl-bot-staging/google-cloud-bigquery-reservation/v1/system-test/fixtures/sample/src/index.js new file mode 100644 index 00000000000..7fe58ac561a --- /dev/null +++ b/owl-bot-staging/google-cloud-bigquery-reservation/v1/system-test/fixtures/sample/src/index.js @@ -0,0 +1,27 @@ +// Copyright 2023 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 +// +// https://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. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + +/* eslint-disable node/no-missing-require, no-unused-vars */ +const reservation = require('@google-cloud/bigquery-reservation'); + +function main() { + const reservationServiceClient = new reservation.ReservationServiceClient(); +} + +main(); diff --git a/owl-bot-staging/google-cloud-bigquery-reservation/v1/system-test/fixtures/sample/src/index.ts b/owl-bot-staging/google-cloud-bigquery-reservation/v1/system-test/fixtures/sample/src/index.ts new file mode 100644 index 00000000000..fd3b2a70d20 --- /dev/null +++ b/owl-bot-staging/google-cloud-bigquery-reservation/v1/system-test/fixtures/sample/src/index.ts @@ -0,0 +1,32 @@ +// Copyright 2023 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 +// +// https://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. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + +import {ReservationServiceClient} from '@google-cloud/bigquery-reservation'; + +// check that the client class type name can be used +function doStuffWithReservationServiceClient(client: ReservationServiceClient) { + client.close(); +} + +function main() { + // check that the client instance can be created + const reservationServiceClient = new ReservationServiceClient(); + doStuffWithReservationServiceClient(reservationServiceClient); +} + +main(); diff --git a/owl-bot-staging/google-cloud-bigquery-reservation/v1/system-test/install.ts b/owl-bot-staging/google-cloud-bigquery-reservation/v1/system-test/install.ts new file mode 100644 index 00000000000..c8f81b25a86 --- /dev/null +++ b/owl-bot-staging/google-cloud-bigquery-reservation/v1/system-test/install.ts @@ -0,0 +1,49 @@ +// Copyright 2023 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 +// +// https://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. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + +import {packNTest} from 'pack-n-play'; +import {readFileSync} from 'fs'; +import {describe, it} from 'mocha'; + +describe('📦 pack-n-play test', () => { + + it('TypeScript code', async function() { + this.timeout(300000); + const options = { + packageDir: process.cwd(), + sample: { + description: 'TypeScript user can use the type definitions', + ts: readFileSync('./system-test/fixtures/sample/src/index.ts').toString() + } + }; + await packNTest(options); + }); + + it('JavaScript code', async function() { + this.timeout(300000); + const options = { + packageDir: process.cwd(), + sample: { + description: 'JavaScript user can use the library', + ts: readFileSync('./system-test/fixtures/sample/src/index.js').toString() + } + }; + await packNTest(options); + }); + +}); diff --git a/owl-bot-staging/google-cloud-bigquery-reservation/v1/test/gapic_reservation_service_v1.ts b/owl-bot-staging/google-cloud-bigquery-reservation/v1/test/gapic_reservation_service_v1.ts new file mode 100644 index 00000000000..20dbf2a7e38 --- /dev/null +++ b/owl-bot-staging/google-cloud-bigquery-reservation/v1/test/gapic_reservation_service_v1.ts @@ -0,0 +1,3435 @@ +// Copyright 2023 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 +// +// https://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. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + +import * as protos from '../protos/protos'; +import * as assert from 'assert'; +import * as sinon from 'sinon'; +import {SinonStub} from 'sinon'; +import {describe, it} from 'mocha'; +import * as reservationserviceModule from '../src'; + +import {PassThrough} from 'stream'; + +import {protobuf} from 'google-gax'; + +// Dynamically loaded proto JSON is needed to get the type information +// to fill in default values for request objects +const root = protobuf.Root.fromJSON(require('../protos/protos.json')).resolveAll(); + +// eslint-disable-next-line @typescript-eslint/no-unused-vars +function getTypeDefaultValue(typeName: string, fields: string[]) { + let type = root.lookupType(typeName) as protobuf.Type; + for (const field of fields.slice(0, -1)) { + type = type.fields[field]?.resolvedType as protobuf.Type; + } + return type.fields[fields[fields.length - 1]]?.defaultValue; +} + +function generateSampleMessage(instance: T) { + const filledObject = (instance.constructor as typeof protobuf.Message) + .toObject(instance as protobuf.Message, {defaults: true}); + return (instance.constructor as typeof protobuf.Message).fromObject(filledObject) as T; +} + +function stubSimpleCall(response?: ResponseType, error?: Error) { + return error ? sinon.stub().rejects(error) : sinon.stub().resolves([response]); +} + +function stubSimpleCallWithCallback(response?: ResponseType, error?: Error) { + return error ? sinon.stub().callsArgWith(2, error) : sinon.stub().callsArgWith(2, null, response); +} + +function stubPageStreamingCall(responses?: ResponseType[], error?: Error) { + const pagingStub = sinon.stub(); + if (responses) { + for (let i = 0; i < responses.length; ++i) { + pagingStub.onCall(i).callsArgWith(2, null, responses[i]); + } + } + const transformStub = error ? sinon.stub().callsArgWith(2, error) : pagingStub; + const mockStream = new PassThrough({ + objectMode: true, + transform: transformStub, + }); + // trigger as many responses as needed + if (responses) { + for (let i = 0; i < responses.length; ++i) { + setImmediate(() => { mockStream.write({}); }); + } + setImmediate(() => { mockStream.end(); }); + } else { + setImmediate(() => { mockStream.write({}); }); + setImmediate(() => { mockStream.end(); }); + } + return sinon.stub().returns(mockStream); +} + +function stubAsyncIterationCall(responses?: ResponseType[], error?: Error) { + let counter = 0; + const asyncIterable = { + [Symbol.asyncIterator]() { + return { + async next() { + if (error) { + return Promise.reject(error); + } + if (counter >= responses!.length) { + return Promise.resolve({done: true, value: undefined}); + } + return Promise.resolve({done: false, value: responses![counter++]}); + } + }; + } + }; + return sinon.stub().returns(asyncIterable); +} + +describe('v1.ReservationServiceClient', () => { + describe('Common methods', () => { + it('has servicePath', () => { + const servicePath = reservationserviceModule.v1.ReservationServiceClient.servicePath; + assert(servicePath); + }); + + it('has apiEndpoint', () => { + const apiEndpoint = reservationserviceModule.v1.ReservationServiceClient.apiEndpoint; + assert(apiEndpoint); + }); + + it('has port', () => { + const port = reservationserviceModule.v1.ReservationServiceClient.port; + assert(port); + assert(typeof port === 'number'); + }); + + it('should create a client with no option', () => { + const client = new reservationserviceModule.v1.ReservationServiceClient(); + assert(client); + }); + + it('should create a client with gRPC fallback', () => { + const client = new reservationserviceModule.v1.ReservationServiceClient({ + fallback: true, + }); + assert(client); + }); + + it('has initialize method and supports deferred initialization', async () => { + const client = new reservationserviceModule.v1.ReservationServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + assert.strictEqual(client.reservationServiceStub, undefined); + await client.initialize(); + assert(client.reservationServiceStub); + }); + + it('has close method for the initialized client', done => { + const client = new reservationserviceModule.v1.ReservationServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + assert(client.reservationServiceStub); + client.close().then(() => { + done(); + }); + }); + + it('has close method for the non-initialized client', done => { + const client = new reservationserviceModule.v1.ReservationServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + assert.strictEqual(client.reservationServiceStub, undefined); + client.close().then(() => { + done(); + }); + }); + + it('has getProjectId method', async () => { + const fakeProjectId = 'fake-project-id'; + const client = new reservationserviceModule.v1.ReservationServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.auth.getProjectId = sinon.stub().resolves(fakeProjectId); + const result = await client.getProjectId(); + assert.strictEqual(result, fakeProjectId); + assert((client.auth.getProjectId as SinonStub).calledWithExactly()); + }); + + it('has getProjectId method with callback', async () => { + const fakeProjectId = 'fake-project-id'; + const client = new reservationserviceModule.v1.ReservationServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.auth.getProjectId = sinon.stub().callsArgWith(0, null, fakeProjectId); + const promise = new Promise((resolve, reject) => { + client.getProjectId((err?: Error|null, projectId?: string|null) => { + if (err) { + reject(err); + } else { + resolve(projectId); + } + }); + }); + const result = await promise; + assert.strictEqual(result, fakeProjectId); + }); + }); + + describe('createReservation', () => { + it('invokes createReservation without error', async () => { + const client = new reservationserviceModule.v1.ReservationServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.bigquery.reservation.v1.CreateReservationRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.bigquery.reservation.v1.CreateReservationRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.bigquery.reservation.v1.Reservation() + ); + client.innerApiCalls.createReservation = stubSimpleCall(expectedResponse); + const [response] = await client.createReservation(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.createReservation as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.createReservation as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes createReservation without error using callback', async () => { + const client = new reservationserviceModule.v1.ReservationServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.bigquery.reservation.v1.CreateReservationRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.bigquery.reservation.v1.CreateReservationRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.bigquery.reservation.v1.Reservation() + ); + client.innerApiCalls.createReservation = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.createReservation( + request, + (err?: Error|null, result?: protos.google.cloud.bigquery.reservation.v1.IReservation|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.createReservation as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.createReservation as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes createReservation with error', async () => { + const client = new reservationserviceModule.v1.ReservationServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.bigquery.reservation.v1.CreateReservationRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.bigquery.reservation.v1.CreateReservationRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.createReservation = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.createReservation(request), expectedError); + const actualRequest = (client.innerApiCalls.createReservation as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.createReservation as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes createReservation with closed client', async () => { + const client = new reservationserviceModule.v1.ReservationServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.bigquery.reservation.v1.CreateReservationRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.bigquery.reservation.v1.CreateReservationRequest', ['parent']); + request.parent = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.createReservation(request), expectedError); + }); + }); + + describe('getReservation', () => { + it('invokes getReservation without error', async () => { + const client = new reservationserviceModule.v1.ReservationServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.bigquery.reservation.v1.GetReservationRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.bigquery.reservation.v1.GetReservationRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.bigquery.reservation.v1.Reservation() + ); + client.innerApiCalls.getReservation = stubSimpleCall(expectedResponse); + const [response] = await client.getReservation(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.getReservation as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getReservation as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getReservation without error using callback', async () => { + const client = new reservationserviceModule.v1.ReservationServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.bigquery.reservation.v1.GetReservationRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.bigquery.reservation.v1.GetReservationRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.bigquery.reservation.v1.Reservation() + ); + client.innerApiCalls.getReservation = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getReservation( + request, + (err?: Error|null, result?: protos.google.cloud.bigquery.reservation.v1.IReservation|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.getReservation as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getReservation as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getReservation with error', async () => { + const client = new reservationserviceModule.v1.ReservationServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.bigquery.reservation.v1.GetReservationRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.bigquery.reservation.v1.GetReservationRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.getReservation = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.getReservation(request), expectedError); + const actualRequest = (client.innerApiCalls.getReservation as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getReservation as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getReservation with closed client', async () => { + const client = new reservationserviceModule.v1.ReservationServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.bigquery.reservation.v1.GetReservationRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.bigquery.reservation.v1.GetReservationRequest', ['name']); + request.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.getReservation(request), expectedError); + }); + }); + + describe('deleteReservation', () => { + it('invokes deleteReservation without error', async () => { + const client = new reservationserviceModule.v1.ReservationServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.bigquery.reservation.v1.DeleteReservationRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.bigquery.reservation.v1.DeleteReservationRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.protobuf.Empty() + ); + client.innerApiCalls.deleteReservation = stubSimpleCall(expectedResponse); + const [response] = await client.deleteReservation(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.deleteReservation as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.deleteReservation as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes deleteReservation without error using callback', async () => { + const client = new reservationserviceModule.v1.ReservationServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.bigquery.reservation.v1.DeleteReservationRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.bigquery.reservation.v1.DeleteReservationRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.protobuf.Empty() + ); + client.innerApiCalls.deleteReservation = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.deleteReservation( + request, + (err?: Error|null, result?: protos.google.protobuf.IEmpty|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.deleteReservation as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.deleteReservation as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes deleteReservation with error', async () => { + const client = new reservationserviceModule.v1.ReservationServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.bigquery.reservation.v1.DeleteReservationRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.bigquery.reservation.v1.DeleteReservationRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.deleteReservation = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.deleteReservation(request), expectedError); + const actualRequest = (client.innerApiCalls.deleteReservation as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.deleteReservation as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes deleteReservation with closed client', async () => { + const client = new reservationserviceModule.v1.ReservationServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.bigquery.reservation.v1.DeleteReservationRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.bigquery.reservation.v1.DeleteReservationRequest', ['name']); + request.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.deleteReservation(request), expectedError); + }); + }); + + describe('updateReservation', () => { + it('invokes updateReservation without error', async () => { + const client = new reservationserviceModule.v1.ReservationServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.bigquery.reservation.v1.UpdateReservationRequest() + ); + request.reservation ??= {}; + const defaultValue1 = + getTypeDefaultValue('.google.cloud.bigquery.reservation.v1.UpdateReservationRequest', ['reservation', 'name']); + request.reservation.name = defaultValue1; + const expectedHeaderRequestParams = `reservation.name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.bigquery.reservation.v1.Reservation() + ); + client.innerApiCalls.updateReservation = stubSimpleCall(expectedResponse); + const [response] = await client.updateReservation(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.updateReservation as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.updateReservation as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes updateReservation without error using callback', async () => { + const client = new reservationserviceModule.v1.ReservationServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.bigquery.reservation.v1.UpdateReservationRequest() + ); + request.reservation ??= {}; + const defaultValue1 = + getTypeDefaultValue('.google.cloud.bigquery.reservation.v1.UpdateReservationRequest', ['reservation', 'name']); + request.reservation.name = defaultValue1; + const expectedHeaderRequestParams = `reservation.name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.bigquery.reservation.v1.Reservation() + ); + client.innerApiCalls.updateReservation = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.updateReservation( + request, + (err?: Error|null, result?: protos.google.cloud.bigquery.reservation.v1.IReservation|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.updateReservation as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.updateReservation as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes updateReservation with error', async () => { + const client = new reservationserviceModule.v1.ReservationServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.bigquery.reservation.v1.UpdateReservationRequest() + ); + request.reservation ??= {}; + const defaultValue1 = + getTypeDefaultValue('.google.cloud.bigquery.reservation.v1.UpdateReservationRequest', ['reservation', 'name']); + request.reservation.name = defaultValue1; + const expectedHeaderRequestParams = `reservation.name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.updateReservation = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.updateReservation(request), expectedError); + const actualRequest = (client.innerApiCalls.updateReservation as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.updateReservation as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes updateReservation with closed client', async () => { + const client = new reservationserviceModule.v1.ReservationServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.bigquery.reservation.v1.UpdateReservationRequest() + ); + request.reservation ??= {}; + const defaultValue1 = + getTypeDefaultValue('.google.cloud.bigquery.reservation.v1.UpdateReservationRequest', ['reservation', 'name']); + request.reservation.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.updateReservation(request), expectedError); + }); + }); + + describe('createCapacityCommitment', () => { + it('invokes createCapacityCommitment without error', async () => { + const client = new reservationserviceModule.v1.ReservationServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.bigquery.reservation.v1.CreateCapacityCommitmentRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.bigquery.reservation.v1.CreateCapacityCommitmentRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.bigquery.reservation.v1.CapacityCommitment() + ); + client.innerApiCalls.createCapacityCommitment = stubSimpleCall(expectedResponse); + const [response] = await client.createCapacityCommitment(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.createCapacityCommitment as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.createCapacityCommitment as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes createCapacityCommitment without error using callback', async () => { + const client = new reservationserviceModule.v1.ReservationServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.bigquery.reservation.v1.CreateCapacityCommitmentRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.bigquery.reservation.v1.CreateCapacityCommitmentRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.bigquery.reservation.v1.CapacityCommitment() + ); + client.innerApiCalls.createCapacityCommitment = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.createCapacityCommitment( + request, + (err?: Error|null, result?: protos.google.cloud.bigquery.reservation.v1.ICapacityCommitment|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.createCapacityCommitment as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.createCapacityCommitment as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes createCapacityCommitment with error', async () => { + const client = new reservationserviceModule.v1.ReservationServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.bigquery.reservation.v1.CreateCapacityCommitmentRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.bigquery.reservation.v1.CreateCapacityCommitmentRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.createCapacityCommitment = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.createCapacityCommitment(request), expectedError); + const actualRequest = (client.innerApiCalls.createCapacityCommitment as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.createCapacityCommitment as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes createCapacityCommitment with closed client', async () => { + const client = new reservationserviceModule.v1.ReservationServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.bigquery.reservation.v1.CreateCapacityCommitmentRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.bigquery.reservation.v1.CreateCapacityCommitmentRequest', ['parent']); + request.parent = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.createCapacityCommitment(request), expectedError); + }); + }); + + describe('getCapacityCommitment', () => { + it('invokes getCapacityCommitment without error', async () => { + const client = new reservationserviceModule.v1.ReservationServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.bigquery.reservation.v1.GetCapacityCommitmentRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.bigquery.reservation.v1.GetCapacityCommitmentRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.bigquery.reservation.v1.CapacityCommitment() + ); + client.innerApiCalls.getCapacityCommitment = stubSimpleCall(expectedResponse); + const [response] = await client.getCapacityCommitment(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.getCapacityCommitment as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getCapacityCommitment as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getCapacityCommitment without error using callback', async () => { + const client = new reservationserviceModule.v1.ReservationServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.bigquery.reservation.v1.GetCapacityCommitmentRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.bigquery.reservation.v1.GetCapacityCommitmentRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.bigquery.reservation.v1.CapacityCommitment() + ); + client.innerApiCalls.getCapacityCommitment = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getCapacityCommitment( + request, + (err?: Error|null, result?: protos.google.cloud.bigquery.reservation.v1.ICapacityCommitment|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.getCapacityCommitment as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getCapacityCommitment as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getCapacityCommitment with error', async () => { + const client = new reservationserviceModule.v1.ReservationServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.bigquery.reservation.v1.GetCapacityCommitmentRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.bigquery.reservation.v1.GetCapacityCommitmentRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.getCapacityCommitment = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.getCapacityCommitment(request), expectedError); + const actualRequest = (client.innerApiCalls.getCapacityCommitment as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getCapacityCommitment as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getCapacityCommitment with closed client', async () => { + const client = new reservationserviceModule.v1.ReservationServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.bigquery.reservation.v1.GetCapacityCommitmentRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.bigquery.reservation.v1.GetCapacityCommitmentRequest', ['name']); + request.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.getCapacityCommitment(request), expectedError); + }); + }); + + describe('deleteCapacityCommitment', () => { + it('invokes deleteCapacityCommitment without error', async () => { + const client = new reservationserviceModule.v1.ReservationServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.bigquery.reservation.v1.DeleteCapacityCommitmentRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.bigquery.reservation.v1.DeleteCapacityCommitmentRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.protobuf.Empty() + ); + client.innerApiCalls.deleteCapacityCommitment = stubSimpleCall(expectedResponse); + const [response] = await client.deleteCapacityCommitment(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.deleteCapacityCommitment as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.deleteCapacityCommitment as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes deleteCapacityCommitment without error using callback', async () => { + const client = new reservationserviceModule.v1.ReservationServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.bigquery.reservation.v1.DeleteCapacityCommitmentRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.bigquery.reservation.v1.DeleteCapacityCommitmentRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.protobuf.Empty() + ); + client.innerApiCalls.deleteCapacityCommitment = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.deleteCapacityCommitment( + request, + (err?: Error|null, result?: protos.google.protobuf.IEmpty|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.deleteCapacityCommitment as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.deleteCapacityCommitment as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes deleteCapacityCommitment with error', async () => { + const client = new reservationserviceModule.v1.ReservationServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.bigquery.reservation.v1.DeleteCapacityCommitmentRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.bigquery.reservation.v1.DeleteCapacityCommitmentRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.deleteCapacityCommitment = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.deleteCapacityCommitment(request), expectedError); + const actualRequest = (client.innerApiCalls.deleteCapacityCommitment as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.deleteCapacityCommitment as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes deleteCapacityCommitment with closed client', async () => { + const client = new reservationserviceModule.v1.ReservationServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.bigquery.reservation.v1.DeleteCapacityCommitmentRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.bigquery.reservation.v1.DeleteCapacityCommitmentRequest', ['name']); + request.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.deleteCapacityCommitment(request), expectedError); + }); + }); + + describe('updateCapacityCommitment', () => { + it('invokes updateCapacityCommitment without error', async () => { + const client = new reservationserviceModule.v1.ReservationServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.bigquery.reservation.v1.UpdateCapacityCommitmentRequest() + ); + request.capacityCommitment ??= {}; + const defaultValue1 = + getTypeDefaultValue('.google.cloud.bigquery.reservation.v1.UpdateCapacityCommitmentRequest', ['capacityCommitment', 'name']); + request.capacityCommitment.name = defaultValue1; + const expectedHeaderRequestParams = `capacity_commitment.name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.bigquery.reservation.v1.CapacityCommitment() + ); + client.innerApiCalls.updateCapacityCommitment = stubSimpleCall(expectedResponse); + const [response] = await client.updateCapacityCommitment(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.updateCapacityCommitment as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.updateCapacityCommitment as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes updateCapacityCommitment without error using callback', async () => { + const client = new reservationserviceModule.v1.ReservationServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.bigquery.reservation.v1.UpdateCapacityCommitmentRequest() + ); + request.capacityCommitment ??= {}; + const defaultValue1 = + getTypeDefaultValue('.google.cloud.bigquery.reservation.v1.UpdateCapacityCommitmentRequest', ['capacityCommitment', 'name']); + request.capacityCommitment.name = defaultValue1; + const expectedHeaderRequestParams = `capacity_commitment.name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.bigquery.reservation.v1.CapacityCommitment() + ); + client.innerApiCalls.updateCapacityCommitment = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.updateCapacityCommitment( + request, + (err?: Error|null, result?: protos.google.cloud.bigquery.reservation.v1.ICapacityCommitment|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.updateCapacityCommitment as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.updateCapacityCommitment as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes updateCapacityCommitment with error', async () => { + const client = new reservationserviceModule.v1.ReservationServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.bigquery.reservation.v1.UpdateCapacityCommitmentRequest() + ); + request.capacityCommitment ??= {}; + const defaultValue1 = + getTypeDefaultValue('.google.cloud.bigquery.reservation.v1.UpdateCapacityCommitmentRequest', ['capacityCommitment', 'name']); + request.capacityCommitment.name = defaultValue1; + const expectedHeaderRequestParams = `capacity_commitment.name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.updateCapacityCommitment = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.updateCapacityCommitment(request), expectedError); + const actualRequest = (client.innerApiCalls.updateCapacityCommitment as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.updateCapacityCommitment as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes updateCapacityCommitment with closed client', async () => { + const client = new reservationserviceModule.v1.ReservationServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.bigquery.reservation.v1.UpdateCapacityCommitmentRequest() + ); + request.capacityCommitment ??= {}; + const defaultValue1 = + getTypeDefaultValue('.google.cloud.bigquery.reservation.v1.UpdateCapacityCommitmentRequest', ['capacityCommitment', 'name']); + request.capacityCommitment.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.updateCapacityCommitment(request), expectedError); + }); + }); + + describe('splitCapacityCommitment', () => { + it('invokes splitCapacityCommitment without error', async () => { + const client = new reservationserviceModule.v1.ReservationServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.bigquery.reservation.v1.SplitCapacityCommitmentRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.bigquery.reservation.v1.SplitCapacityCommitmentRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.bigquery.reservation.v1.SplitCapacityCommitmentResponse() + ); + client.innerApiCalls.splitCapacityCommitment = stubSimpleCall(expectedResponse); + const [response] = await client.splitCapacityCommitment(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.splitCapacityCommitment as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.splitCapacityCommitment as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes splitCapacityCommitment without error using callback', async () => { + const client = new reservationserviceModule.v1.ReservationServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.bigquery.reservation.v1.SplitCapacityCommitmentRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.bigquery.reservation.v1.SplitCapacityCommitmentRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.bigquery.reservation.v1.SplitCapacityCommitmentResponse() + ); + client.innerApiCalls.splitCapacityCommitment = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.splitCapacityCommitment( + request, + (err?: Error|null, result?: protos.google.cloud.bigquery.reservation.v1.ISplitCapacityCommitmentResponse|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.splitCapacityCommitment as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.splitCapacityCommitment as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes splitCapacityCommitment with error', async () => { + const client = new reservationserviceModule.v1.ReservationServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.bigquery.reservation.v1.SplitCapacityCommitmentRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.bigquery.reservation.v1.SplitCapacityCommitmentRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.splitCapacityCommitment = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.splitCapacityCommitment(request), expectedError); + const actualRequest = (client.innerApiCalls.splitCapacityCommitment as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.splitCapacityCommitment as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes splitCapacityCommitment with closed client', async () => { + const client = new reservationserviceModule.v1.ReservationServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.bigquery.reservation.v1.SplitCapacityCommitmentRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.bigquery.reservation.v1.SplitCapacityCommitmentRequest', ['name']); + request.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.splitCapacityCommitment(request), expectedError); + }); + }); + + describe('mergeCapacityCommitments', () => { + it('invokes mergeCapacityCommitments without error', async () => { + const client = new reservationserviceModule.v1.ReservationServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.bigquery.reservation.v1.MergeCapacityCommitmentsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.bigquery.reservation.v1.MergeCapacityCommitmentsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.bigquery.reservation.v1.CapacityCommitment() + ); + client.innerApiCalls.mergeCapacityCommitments = stubSimpleCall(expectedResponse); + const [response] = await client.mergeCapacityCommitments(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.mergeCapacityCommitments as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.mergeCapacityCommitments as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes mergeCapacityCommitments without error using callback', async () => { + const client = new reservationserviceModule.v1.ReservationServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.bigquery.reservation.v1.MergeCapacityCommitmentsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.bigquery.reservation.v1.MergeCapacityCommitmentsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.bigquery.reservation.v1.CapacityCommitment() + ); + client.innerApiCalls.mergeCapacityCommitments = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.mergeCapacityCommitments( + request, + (err?: Error|null, result?: protos.google.cloud.bigquery.reservation.v1.ICapacityCommitment|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.mergeCapacityCommitments as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.mergeCapacityCommitments as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes mergeCapacityCommitments with error', async () => { + const client = new reservationserviceModule.v1.ReservationServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.bigquery.reservation.v1.MergeCapacityCommitmentsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.bigquery.reservation.v1.MergeCapacityCommitmentsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.mergeCapacityCommitments = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.mergeCapacityCommitments(request), expectedError); + const actualRequest = (client.innerApiCalls.mergeCapacityCommitments as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.mergeCapacityCommitments as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes mergeCapacityCommitments with closed client', async () => { + const client = new reservationserviceModule.v1.ReservationServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.bigquery.reservation.v1.MergeCapacityCommitmentsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.bigquery.reservation.v1.MergeCapacityCommitmentsRequest', ['parent']); + request.parent = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.mergeCapacityCommitments(request), expectedError); + }); + }); + + describe('createAssignment', () => { + it('invokes createAssignment without error', async () => { + const client = new reservationserviceModule.v1.ReservationServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.bigquery.reservation.v1.CreateAssignmentRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.bigquery.reservation.v1.CreateAssignmentRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.bigquery.reservation.v1.Assignment() + ); + client.innerApiCalls.createAssignment = stubSimpleCall(expectedResponse); + const [response] = await client.createAssignment(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.createAssignment as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.createAssignment as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes createAssignment without error using callback', async () => { + const client = new reservationserviceModule.v1.ReservationServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.bigquery.reservation.v1.CreateAssignmentRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.bigquery.reservation.v1.CreateAssignmentRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.bigquery.reservation.v1.Assignment() + ); + client.innerApiCalls.createAssignment = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.createAssignment( + request, + (err?: Error|null, result?: protos.google.cloud.bigquery.reservation.v1.IAssignment|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.createAssignment as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.createAssignment as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes createAssignment with error', async () => { + const client = new reservationserviceModule.v1.ReservationServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.bigquery.reservation.v1.CreateAssignmentRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.bigquery.reservation.v1.CreateAssignmentRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.createAssignment = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.createAssignment(request), expectedError); + const actualRequest = (client.innerApiCalls.createAssignment as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.createAssignment as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes createAssignment with closed client', async () => { + const client = new reservationserviceModule.v1.ReservationServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.bigquery.reservation.v1.CreateAssignmentRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.bigquery.reservation.v1.CreateAssignmentRequest', ['parent']); + request.parent = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.createAssignment(request), expectedError); + }); + }); + + describe('deleteAssignment', () => { + it('invokes deleteAssignment without error', async () => { + const client = new reservationserviceModule.v1.ReservationServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.bigquery.reservation.v1.DeleteAssignmentRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.bigquery.reservation.v1.DeleteAssignmentRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.protobuf.Empty() + ); + client.innerApiCalls.deleteAssignment = stubSimpleCall(expectedResponse); + const [response] = await client.deleteAssignment(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.deleteAssignment as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.deleteAssignment as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes deleteAssignment without error using callback', async () => { + const client = new reservationserviceModule.v1.ReservationServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.bigquery.reservation.v1.DeleteAssignmentRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.bigquery.reservation.v1.DeleteAssignmentRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.protobuf.Empty() + ); + client.innerApiCalls.deleteAssignment = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.deleteAssignment( + request, + (err?: Error|null, result?: protos.google.protobuf.IEmpty|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.deleteAssignment as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.deleteAssignment as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes deleteAssignment with error', async () => { + const client = new reservationserviceModule.v1.ReservationServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.bigquery.reservation.v1.DeleteAssignmentRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.bigquery.reservation.v1.DeleteAssignmentRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.deleteAssignment = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.deleteAssignment(request), expectedError); + const actualRequest = (client.innerApiCalls.deleteAssignment as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.deleteAssignment as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes deleteAssignment with closed client', async () => { + const client = new reservationserviceModule.v1.ReservationServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.bigquery.reservation.v1.DeleteAssignmentRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.bigquery.reservation.v1.DeleteAssignmentRequest', ['name']); + request.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.deleteAssignment(request), expectedError); + }); + }); + + describe('moveAssignment', () => { + it('invokes moveAssignment without error', async () => { + const client = new reservationserviceModule.v1.ReservationServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.bigquery.reservation.v1.MoveAssignmentRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.bigquery.reservation.v1.MoveAssignmentRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.bigquery.reservation.v1.Assignment() + ); + client.innerApiCalls.moveAssignment = stubSimpleCall(expectedResponse); + const [response] = await client.moveAssignment(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.moveAssignment as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.moveAssignment as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes moveAssignment without error using callback', async () => { + const client = new reservationserviceModule.v1.ReservationServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.bigquery.reservation.v1.MoveAssignmentRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.bigquery.reservation.v1.MoveAssignmentRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.bigquery.reservation.v1.Assignment() + ); + client.innerApiCalls.moveAssignment = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.moveAssignment( + request, + (err?: Error|null, result?: protos.google.cloud.bigquery.reservation.v1.IAssignment|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.moveAssignment as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.moveAssignment as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes moveAssignment with error', async () => { + const client = new reservationserviceModule.v1.ReservationServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.bigquery.reservation.v1.MoveAssignmentRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.bigquery.reservation.v1.MoveAssignmentRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.moveAssignment = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.moveAssignment(request), expectedError); + const actualRequest = (client.innerApiCalls.moveAssignment as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.moveAssignment as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes moveAssignment with closed client', async () => { + const client = new reservationserviceModule.v1.ReservationServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.bigquery.reservation.v1.MoveAssignmentRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.bigquery.reservation.v1.MoveAssignmentRequest', ['name']); + request.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.moveAssignment(request), expectedError); + }); + }); + + describe('updateAssignment', () => { + it('invokes updateAssignment without error', async () => { + const client = new reservationserviceModule.v1.ReservationServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.bigquery.reservation.v1.UpdateAssignmentRequest() + ); + request.assignment ??= {}; + const defaultValue1 = + getTypeDefaultValue('.google.cloud.bigquery.reservation.v1.UpdateAssignmentRequest', ['assignment', 'name']); + request.assignment.name = defaultValue1; + const expectedHeaderRequestParams = `assignment.name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.bigquery.reservation.v1.Assignment() + ); + client.innerApiCalls.updateAssignment = stubSimpleCall(expectedResponse); + const [response] = await client.updateAssignment(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.updateAssignment as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.updateAssignment as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes updateAssignment without error using callback', async () => { + const client = new reservationserviceModule.v1.ReservationServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.bigquery.reservation.v1.UpdateAssignmentRequest() + ); + request.assignment ??= {}; + const defaultValue1 = + getTypeDefaultValue('.google.cloud.bigquery.reservation.v1.UpdateAssignmentRequest', ['assignment', 'name']); + request.assignment.name = defaultValue1; + const expectedHeaderRequestParams = `assignment.name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.bigquery.reservation.v1.Assignment() + ); + client.innerApiCalls.updateAssignment = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.updateAssignment( + request, + (err?: Error|null, result?: protos.google.cloud.bigquery.reservation.v1.IAssignment|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.updateAssignment as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.updateAssignment as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes updateAssignment with error', async () => { + const client = new reservationserviceModule.v1.ReservationServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.bigquery.reservation.v1.UpdateAssignmentRequest() + ); + request.assignment ??= {}; + const defaultValue1 = + getTypeDefaultValue('.google.cloud.bigquery.reservation.v1.UpdateAssignmentRequest', ['assignment', 'name']); + request.assignment.name = defaultValue1; + const expectedHeaderRequestParams = `assignment.name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.updateAssignment = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.updateAssignment(request), expectedError); + const actualRequest = (client.innerApiCalls.updateAssignment as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.updateAssignment as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes updateAssignment with closed client', async () => { + const client = new reservationserviceModule.v1.ReservationServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.bigquery.reservation.v1.UpdateAssignmentRequest() + ); + request.assignment ??= {}; + const defaultValue1 = + getTypeDefaultValue('.google.cloud.bigquery.reservation.v1.UpdateAssignmentRequest', ['assignment', 'name']); + request.assignment.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.updateAssignment(request), expectedError); + }); + }); + + describe('getBiReservation', () => { + it('invokes getBiReservation without error', async () => { + const client = new reservationserviceModule.v1.ReservationServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.bigquery.reservation.v1.GetBiReservationRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.bigquery.reservation.v1.GetBiReservationRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.bigquery.reservation.v1.BiReservation() + ); + client.innerApiCalls.getBiReservation = stubSimpleCall(expectedResponse); + const [response] = await client.getBiReservation(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.getBiReservation as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getBiReservation as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getBiReservation without error using callback', async () => { + const client = new reservationserviceModule.v1.ReservationServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.bigquery.reservation.v1.GetBiReservationRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.bigquery.reservation.v1.GetBiReservationRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.bigquery.reservation.v1.BiReservation() + ); + client.innerApiCalls.getBiReservation = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getBiReservation( + request, + (err?: Error|null, result?: protos.google.cloud.bigquery.reservation.v1.IBiReservation|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.getBiReservation as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getBiReservation as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getBiReservation with error', async () => { + const client = new reservationserviceModule.v1.ReservationServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.bigquery.reservation.v1.GetBiReservationRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.bigquery.reservation.v1.GetBiReservationRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.getBiReservation = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.getBiReservation(request), expectedError); + const actualRequest = (client.innerApiCalls.getBiReservation as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getBiReservation as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getBiReservation with closed client', async () => { + const client = new reservationserviceModule.v1.ReservationServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.bigquery.reservation.v1.GetBiReservationRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.bigquery.reservation.v1.GetBiReservationRequest', ['name']); + request.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.getBiReservation(request), expectedError); + }); + }); + + describe('updateBiReservation', () => { + it('invokes updateBiReservation without error', async () => { + const client = new reservationserviceModule.v1.ReservationServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.bigquery.reservation.v1.UpdateBiReservationRequest() + ); + request.biReservation ??= {}; + const defaultValue1 = + getTypeDefaultValue('.google.cloud.bigquery.reservation.v1.UpdateBiReservationRequest', ['biReservation', 'name']); + request.biReservation.name = defaultValue1; + const expectedHeaderRequestParams = `bi_reservation.name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.bigquery.reservation.v1.BiReservation() + ); + client.innerApiCalls.updateBiReservation = stubSimpleCall(expectedResponse); + const [response] = await client.updateBiReservation(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.updateBiReservation as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.updateBiReservation as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes updateBiReservation without error using callback', async () => { + const client = new reservationserviceModule.v1.ReservationServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.bigquery.reservation.v1.UpdateBiReservationRequest() + ); + request.biReservation ??= {}; + const defaultValue1 = + getTypeDefaultValue('.google.cloud.bigquery.reservation.v1.UpdateBiReservationRequest', ['biReservation', 'name']); + request.biReservation.name = defaultValue1; + const expectedHeaderRequestParams = `bi_reservation.name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.bigquery.reservation.v1.BiReservation() + ); + client.innerApiCalls.updateBiReservation = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.updateBiReservation( + request, + (err?: Error|null, result?: protos.google.cloud.bigquery.reservation.v1.IBiReservation|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.updateBiReservation as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.updateBiReservation as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes updateBiReservation with error', async () => { + const client = new reservationserviceModule.v1.ReservationServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.bigquery.reservation.v1.UpdateBiReservationRequest() + ); + request.biReservation ??= {}; + const defaultValue1 = + getTypeDefaultValue('.google.cloud.bigquery.reservation.v1.UpdateBiReservationRequest', ['biReservation', 'name']); + request.biReservation.name = defaultValue1; + const expectedHeaderRequestParams = `bi_reservation.name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.updateBiReservation = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.updateBiReservation(request), expectedError); + const actualRequest = (client.innerApiCalls.updateBiReservation as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.updateBiReservation as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes updateBiReservation with closed client', async () => { + const client = new reservationserviceModule.v1.ReservationServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.bigquery.reservation.v1.UpdateBiReservationRequest() + ); + request.biReservation ??= {}; + const defaultValue1 = + getTypeDefaultValue('.google.cloud.bigquery.reservation.v1.UpdateBiReservationRequest', ['biReservation', 'name']); + request.biReservation.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.updateBiReservation(request), expectedError); + }); + }); + + describe('listReservations', () => { + it('invokes listReservations without error', async () => { + const client = new reservationserviceModule.v1.ReservationServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.bigquery.reservation.v1.ListReservationsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.bigquery.reservation.v1.ListReservationsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.bigquery.reservation.v1.Reservation()), + generateSampleMessage(new protos.google.cloud.bigquery.reservation.v1.Reservation()), + generateSampleMessage(new protos.google.cloud.bigquery.reservation.v1.Reservation()), + ]; + client.innerApiCalls.listReservations = stubSimpleCall(expectedResponse); + const [response] = await client.listReservations(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.listReservations as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listReservations as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listReservations without error using callback', async () => { + const client = new reservationserviceModule.v1.ReservationServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.bigquery.reservation.v1.ListReservationsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.bigquery.reservation.v1.ListReservationsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.bigquery.reservation.v1.Reservation()), + generateSampleMessage(new protos.google.cloud.bigquery.reservation.v1.Reservation()), + generateSampleMessage(new protos.google.cloud.bigquery.reservation.v1.Reservation()), + ]; + client.innerApiCalls.listReservations = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.listReservations( + request, + (err?: Error|null, result?: protos.google.cloud.bigquery.reservation.v1.IReservation[]|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.listReservations as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listReservations as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listReservations with error', async () => { + const client = new reservationserviceModule.v1.ReservationServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.bigquery.reservation.v1.ListReservationsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.bigquery.reservation.v1.ListReservationsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.listReservations = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.listReservations(request), expectedError); + const actualRequest = (client.innerApiCalls.listReservations as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listReservations as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listReservationsStream without error', async () => { + const client = new reservationserviceModule.v1.ReservationServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.bigquery.reservation.v1.ListReservationsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.bigquery.reservation.v1.ListReservationsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.bigquery.reservation.v1.Reservation()), + generateSampleMessage(new protos.google.cloud.bigquery.reservation.v1.Reservation()), + generateSampleMessage(new protos.google.cloud.bigquery.reservation.v1.Reservation()), + ]; + client.descriptors.page.listReservations.createStream = stubPageStreamingCall(expectedResponse); + const stream = client.listReservationsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.bigquery.reservation.v1.Reservation[] = []; + stream.on('data', (response: protos.google.cloud.bigquery.reservation.v1.Reservation) => { + responses.push(response); + }); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + const responses = await promise; + assert.deepStrictEqual(responses, expectedResponse); + assert((client.descriptors.page.listReservations.createStream as SinonStub) + .getCall(0).calledWith(client.innerApiCalls.listReservations, request)); + assert( + (client.descriptors.page.listReservations.createStream as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('invokes listReservationsStream with error', async () => { + const client = new reservationserviceModule.v1.ReservationServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.bigquery.reservation.v1.ListReservationsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.bigquery.reservation.v1.ListReservationsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.descriptors.page.listReservations.createStream = stubPageStreamingCall(undefined, expectedError); + const stream = client.listReservationsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.bigquery.reservation.v1.Reservation[] = []; + stream.on('data', (response: protos.google.cloud.bigquery.reservation.v1.Reservation) => { + responses.push(response); + }); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + await assert.rejects(promise, expectedError); + assert((client.descriptors.page.listReservations.createStream as SinonStub) + .getCall(0).calledWith(client.innerApiCalls.listReservations, request)); + assert( + (client.descriptors.page.listReservations.createStream as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('uses async iteration with listReservations without error', async () => { + const client = new reservationserviceModule.v1.ReservationServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.bigquery.reservation.v1.ListReservationsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.bigquery.reservation.v1.ListReservationsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.bigquery.reservation.v1.Reservation()), + generateSampleMessage(new protos.google.cloud.bigquery.reservation.v1.Reservation()), + generateSampleMessage(new protos.google.cloud.bigquery.reservation.v1.Reservation()), + ]; + client.descriptors.page.listReservations.asyncIterate = stubAsyncIterationCall(expectedResponse); + const responses: protos.google.cloud.bigquery.reservation.v1.IReservation[] = []; + const iterable = client.listReservationsAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + (client.descriptors.page.listReservations.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert( + (client.descriptors.page.listReservations.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('uses async iteration with listReservations with error', async () => { + const client = new reservationserviceModule.v1.ReservationServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.bigquery.reservation.v1.ListReservationsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.bigquery.reservation.v1.ListReservationsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.descriptors.page.listReservations.asyncIterate = stubAsyncIterationCall(undefined, expectedError); + const iterable = client.listReservationsAsync(request); + await assert.rejects(async () => { + const responses: protos.google.cloud.bigquery.reservation.v1.IReservation[] = []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + (client.descriptors.page.listReservations.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert( + (client.descriptors.page.listReservations.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + }); + + describe('listCapacityCommitments', () => { + it('invokes listCapacityCommitments without error', async () => { + const client = new reservationserviceModule.v1.ReservationServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.bigquery.reservation.v1.ListCapacityCommitmentsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.bigquery.reservation.v1.ListCapacityCommitmentsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.bigquery.reservation.v1.CapacityCommitment()), + generateSampleMessage(new protos.google.cloud.bigquery.reservation.v1.CapacityCommitment()), + generateSampleMessage(new protos.google.cloud.bigquery.reservation.v1.CapacityCommitment()), + ]; + client.innerApiCalls.listCapacityCommitments = stubSimpleCall(expectedResponse); + const [response] = await client.listCapacityCommitments(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.listCapacityCommitments as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listCapacityCommitments as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listCapacityCommitments without error using callback', async () => { + const client = new reservationserviceModule.v1.ReservationServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.bigquery.reservation.v1.ListCapacityCommitmentsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.bigquery.reservation.v1.ListCapacityCommitmentsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.bigquery.reservation.v1.CapacityCommitment()), + generateSampleMessage(new protos.google.cloud.bigquery.reservation.v1.CapacityCommitment()), + generateSampleMessage(new protos.google.cloud.bigquery.reservation.v1.CapacityCommitment()), + ]; + client.innerApiCalls.listCapacityCommitments = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.listCapacityCommitments( + request, + (err?: Error|null, result?: protos.google.cloud.bigquery.reservation.v1.ICapacityCommitment[]|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.listCapacityCommitments as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listCapacityCommitments as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listCapacityCommitments with error', async () => { + const client = new reservationserviceModule.v1.ReservationServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.bigquery.reservation.v1.ListCapacityCommitmentsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.bigquery.reservation.v1.ListCapacityCommitmentsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.listCapacityCommitments = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.listCapacityCommitments(request), expectedError); + const actualRequest = (client.innerApiCalls.listCapacityCommitments as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listCapacityCommitments as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listCapacityCommitmentsStream without error', async () => { + const client = new reservationserviceModule.v1.ReservationServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.bigquery.reservation.v1.ListCapacityCommitmentsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.bigquery.reservation.v1.ListCapacityCommitmentsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.bigquery.reservation.v1.CapacityCommitment()), + generateSampleMessage(new protos.google.cloud.bigquery.reservation.v1.CapacityCommitment()), + generateSampleMessage(new protos.google.cloud.bigquery.reservation.v1.CapacityCommitment()), + ]; + client.descriptors.page.listCapacityCommitments.createStream = stubPageStreamingCall(expectedResponse); + const stream = client.listCapacityCommitmentsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.bigquery.reservation.v1.CapacityCommitment[] = []; + stream.on('data', (response: protos.google.cloud.bigquery.reservation.v1.CapacityCommitment) => { + responses.push(response); + }); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + const responses = await promise; + assert.deepStrictEqual(responses, expectedResponse); + assert((client.descriptors.page.listCapacityCommitments.createStream as SinonStub) + .getCall(0).calledWith(client.innerApiCalls.listCapacityCommitments, request)); + assert( + (client.descriptors.page.listCapacityCommitments.createStream as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('invokes listCapacityCommitmentsStream with error', async () => { + const client = new reservationserviceModule.v1.ReservationServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.bigquery.reservation.v1.ListCapacityCommitmentsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.bigquery.reservation.v1.ListCapacityCommitmentsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.descriptors.page.listCapacityCommitments.createStream = stubPageStreamingCall(undefined, expectedError); + const stream = client.listCapacityCommitmentsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.bigquery.reservation.v1.CapacityCommitment[] = []; + stream.on('data', (response: protos.google.cloud.bigquery.reservation.v1.CapacityCommitment) => { + responses.push(response); + }); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + await assert.rejects(promise, expectedError); + assert((client.descriptors.page.listCapacityCommitments.createStream as SinonStub) + .getCall(0).calledWith(client.innerApiCalls.listCapacityCommitments, request)); + assert( + (client.descriptors.page.listCapacityCommitments.createStream as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('uses async iteration with listCapacityCommitments without error', async () => { + const client = new reservationserviceModule.v1.ReservationServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.bigquery.reservation.v1.ListCapacityCommitmentsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.bigquery.reservation.v1.ListCapacityCommitmentsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.bigquery.reservation.v1.CapacityCommitment()), + generateSampleMessage(new protos.google.cloud.bigquery.reservation.v1.CapacityCommitment()), + generateSampleMessage(new protos.google.cloud.bigquery.reservation.v1.CapacityCommitment()), + ]; + client.descriptors.page.listCapacityCommitments.asyncIterate = stubAsyncIterationCall(expectedResponse); + const responses: protos.google.cloud.bigquery.reservation.v1.ICapacityCommitment[] = []; + const iterable = client.listCapacityCommitmentsAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + (client.descriptors.page.listCapacityCommitments.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert( + (client.descriptors.page.listCapacityCommitments.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('uses async iteration with listCapacityCommitments with error', async () => { + const client = new reservationserviceModule.v1.ReservationServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.bigquery.reservation.v1.ListCapacityCommitmentsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.bigquery.reservation.v1.ListCapacityCommitmentsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.descriptors.page.listCapacityCommitments.asyncIterate = stubAsyncIterationCall(undefined, expectedError); + const iterable = client.listCapacityCommitmentsAsync(request); + await assert.rejects(async () => { + const responses: protos.google.cloud.bigquery.reservation.v1.ICapacityCommitment[] = []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + (client.descriptors.page.listCapacityCommitments.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert( + (client.descriptors.page.listCapacityCommitments.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + }); + + describe('listAssignments', () => { + it('invokes listAssignments without error', async () => { + const client = new reservationserviceModule.v1.ReservationServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.bigquery.reservation.v1.ListAssignmentsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.bigquery.reservation.v1.ListAssignmentsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.bigquery.reservation.v1.Assignment()), + generateSampleMessage(new protos.google.cloud.bigquery.reservation.v1.Assignment()), + generateSampleMessage(new protos.google.cloud.bigquery.reservation.v1.Assignment()), + ]; + client.innerApiCalls.listAssignments = stubSimpleCall(expectedResponse); + const [response] = await client.listAssignments(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.listAssignments as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listAssignments as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listAssignments without error using callback', async () => { + const client = new reservationserviceModule.v1.ReservationServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.bigquery.reservation.v1.ListAssignmentsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.bigquery.reservation.v1.ListAssignmentsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.bigquery.reservation.v1.Assignment()), + generateSampleMessage(new protos.google.cloud.bigquery.reservation.v1.Assignment()), + generateSampleMessage(new protos.google.cloud.bigquery.reservation.v1.Assignment()), + ]; + client.innerApiCalls.listAssignments = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.listAssignments( + request, + (err?: Error|null, result?: protos.google.cloud.bigquery.reservation.v1.IAssignment[]|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.listAssignments as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listAssignments as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listAssignments with error', async () => { + const client = new reservationserviceModule.v1.ReservationServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.bigquery.reservation.v1.ListAssignmentsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.bigquery.reservation.v1.ListAssignmentsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.listAssignments = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.listAssignments(request), expectedError); + const actualRequest = (client.innerApiCalls.listAssignments as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listAssignments as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listAssignmentsStream without error', async () => { + const client = new reservationserviceModule.v1.ReservationServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.bigquery.reservation.v1.ListAssignmentsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.bigquery.reservation.v1.ListAssignmentsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.bigquery.reservation.v1.Assignment()), + generateSampleMessage(new protos.google.cloud.bigquery.reservation.v1.Assignment()), + generateSampleMessage(new protos.google.cloud.bigquery.reservation.v1.Assignment()), + ]; + client.descriptors.page.listAssignments.createStream = stubPageStreamingCall(expectedResponse); + const stream = client.listAssignmentsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.bigquery.reservation.v1.Assignment[] = []; + stream.on('data', (response: protos.google.cloud.bigquery.reservation.v1.Assignment) => { + responses.push(response); + }); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + const responses = await promise; + assert.deepStrictEqual(responses, expectedResponse); + assert((client.descriptors.page.listAssignments.createStream as SinonStub) + .getCall(0).calledWith(client.innerApiCalls.listAssignments, request)); + assert( + (client.descriptors.page.listAssignments.createStream as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('invokes listAssignmentsStream with error', async () => { + const client = new reservationserviceModule.v1.ReservationServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.bigquery.reservation.v1.ListAssignmentsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.bigquery.reservation.v1.ListAssignmentsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.descriptors.page.listAssignments.createStream = stubPageStreamingCall(undefined, expectedError); + const stream = client.listAssignmentsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.bigquery.reservation.v1.Assignment[] = []; + stream.on('data', (response: protos.google.cloud.bigquery.reservation.v1.Assignment) => { + responses.push(response); + }); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + await assert.rejects(promise, expectedError); + assert((client.descriptors.page.listAssignments.createStream as SinonStub) + .getCall(0).calledWith(client.innerApiCalls.listAssignments, request)); + assert( + (client.descriptors.page.listAssignments.createStream as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('uses async iteration with listAssignments without error', async () => { + const client = new reservationserviceModule.v1.ReservationServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.bigquery.reservation.v1.ListAssignmentsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.bigquery.reservation.v1.ListAssignmentsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.bigquery.reservation.v1.Assignment()), + generateSampleMessage(new protos.google.cloud.bigquery.reservation.v1.Assignment()), + generateSampleMessage(new protos.google.cloud.bigquery.reservation.v1.Assignment()), + ]; + client.descriptors.page.listAssignments.asyncIterate = stubAsyncIterationCall(expectedResponse); + const responses: protos.google.cloud.bigquery.reservation.v1.IAssignment[] = []; + const iterable = client.listAssignmentsAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + (client.descriptors.page.listAssignments.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert( + (client.descriptors.page.listAssignments.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('uses async iteration with listAssignments with error', async () => { + const client = new reservationserviceModule.v1.ReservationServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.bigquery.reservation.v1.ListAssignmentsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.bigquery.reservation.v1.ListAssignmentsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.descriptors.page.listAssignments.asyncIterate = stubAsyncIterationCall(undefined, expectedError); + const iterable = client.listAssignmentsAsync(request); + await assert.rejects(async () => { + const responses: protos.google.cloud.bigquery.reservation.v1.IAssignment[] = []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + (client.descriptors.page.listAssignments.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert( + (client.descriptors.page.listAssignments.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + }); + + describe('searchAssignments', () => { + it('invokes searchAssignments without error', async () => { + const client = new reservationserviceModule.v1.ReservationServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + const stub = sinon.stub(client, 'warn'); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.bigquery.reservation.v1.SearchAssignmentsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.bigquery.reservation.v1.SearchAssignmentsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.bigquery.reservation.v1.Assignment()), + generateSampleMessage(new protos.google.cloud.bigquery.reservation.v1.Assignment()), + generateSampleMessage(new protos.google.cloud.bigquery.reservation.v1.Assignment()), + ]; + client.innerApiCalls.searchAssignments = stubSimpleCall(expectedResponse); + const [response] = await client.searchAssignments(request); + assert(stub.calledOnce); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.searchAssignments as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.searchAssignments as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes searchAssignments without error using callback', async () => { + const client = new reservationserviceModule.v1.ReservationServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + const stub = sinon.stub(client, 'warn'); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.bigquery.reservation.v1.SearchAssignmentsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.bigquery.reservation.v1.SearchAssignmentsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.bigquery.reservation.v1.Assignment()), + generateSampleMessage(new protos.google.cloud.bigquery.reservation.v1.Assignment()), + generateSampleMessage(new protos.google.cloud.bigquery.reservation.v1.Assignment()), + ]; + client.innerApiCalls.searchAssignments = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.searchAssignments( + request, + (err?: Error|null, result?: protos.google.cloud.bigquery.reservation.v1.IAssignment[]|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert(stub.calledOnce); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.searchAssignments as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.searchAssignments as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes searchAssignments with error', async () => { + const client = new reservationserviceModule.v1.ReservationServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + const stub = sinon.stub(client, 'warn'); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.bigquery.reservation.v1.SearchAssignmentsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.bigquery.reservation.v1.SearchAssignmentsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.searchAssignments = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.searchAssignments(request), expectedError); + assert(stub.calledOnce); + const actualRequest = (client.innerApiCalls.searchAssignments as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.searchAssignments as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes searchAssignmentsStream without error', async () => { + const client = new reservationserviceModule.v1.ReservationServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + const stub = sinon.stub(client, 'warn'); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.bigquery.reservation.v1.SearchAssignmentsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.bigquery.reservation.v1.SearchAssignmentsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.bigquery.reservation.v1.Assignment()), + generateSampleMessage(new protos.google.cloud.bigquery.reservation.v1.Assignment()), + generateSampleMessage(new protos.google.cloud.bigquery.reservation.v1.Assignment()), + ]; + client.descriptors.page.searchAssignments.createStream = stubPageStreamingCall(expectedResponse); + const stream = client.searchAssignmentsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.bigquery.reservation.v1.Assignment[] = []; + stream.on('data', (response: protos.google.cloud.bigquery.reservation.v1.Assignment) => { + responses.push(response); + }); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + const responses = await promise; + assert(stub.calledOnce); + assert.deepStrictEqual(responses, expectedResponse); + assert((client.descriptors.page.searchAssignments.createStream as SinonStub) + .getCall(0).calledWith(client.innerApiCalls.searchAssignments, request)); + assert( + (client.descriptors.page.searchAssignments.createStream as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('invokes searchAssignmentsStream with error', async () => { + const client = new reservationserviceModule.v1.ReservationServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + const stub = sinon.stub(client, 'warn'); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.bigquery.reservation.v1.SearchAssignmentsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.bigquery.reservation.v1.SearchAssignmentsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.descriptors.page.searchAssignments.createStream = stubPageStreamingCall(undefined, expectedError); + const stream = client.searchAssignmentsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.bigquery.reservation.v1.Assignment[] = []; + stream.on('data', (response: protos.google.cloud.bigquery.reservation.v1.Assignment) => { + responses.push(response); + }); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + await assert.rejects(promise, expectedError); + assert(stub.calledOnce); + assert((client.descriptors.page.searchAssignments.createStream as SinonStub) + .getCall(0).calledWith(client.innerApiCalls.searchAssignments, request)); + assert( + (client.descriptors.page.searchAssignments.createStream as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('uses async iteration with searchAssignments without error', async () => { + const client = new reservationserviceModule.v1.ReservationServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + const stub = sinon.stub(client, 'warn'); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.bigquery.reservation.v1.SearchAssignmentsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.bigquery.reservation.v1.SearchAssignmentsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.bigquery.reservation.v1.Assignment()), + generateSampleMessage(new protos.google.cloud.bigquery.reservation.v1.Assignment()), + generateSampleMessage(new protos.google.cloud.bigquery.reservation.v1.Assignment()), + ]; + client.descriptors.page.searchAssignments.asyncIterate = stubAsyncIterationCall(expectedResponse); + const responses: protos.google.cloud.bigquery.reservation.v1.IAssignment[] = []; + const iterable = client.searchAssignmentsAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert(stub.calledOnce); + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + (client.descriptors.page.searchAssignments.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert( + (client.descriptors.page.searchAssignments.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('uses async iteration with searchAssignments with error', async () => { + const client = new reservationserviceModule.v1.ReservationServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + const stub = sinon.stub(client, 'warn'); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.bigquery.reservation.v1.SearchAssignmentsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.bigquery.reservation.v1.SearchAssignmentsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.descriptors.page.searchAssignments.asyncIterate = stubAsyncIterationCall(undefined, expectedError); + const iterable = client.searchAssignmentsAsync(request); + await assert.rejects(async () => { + const responses: protos.google.cloud.bigquery.reservation.v1.IAssignment[] = []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert(stub.calledOnce); + assert.deepStrictEqual( + (client.descriptors.page.searchAssignments.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert( + (client.descriptors.page.searchAssignments.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + }); + + describe('searchAllAssignments', () => { + it('invokes searchAllAssignments without error', async () => { + const client = new reservationserviceModule.v1.ReservationServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.bigquery.reservation.v1.SearchAllAssignmentsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.bigquery.reservation.v1.SearchAllAssignmentsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.bigquery.reservation.v1.Assignment()), + generateSampleMessage(new protos.google.cloud.bigquery.reservation.v1.Assignment()), + generateSampleMessage(new protos.google.cloud.bigquery.reservation.v1.Assignment()), + ]; + client.innerApiCalls.searchAllAssignments = stubSimpleCall(expectedResponse); + const [response] = await client.searchAllAssignments(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.searchAllAssignments as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.searchAllAssignments as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes searchAllAssignments without error using callback', async () => { + const client = new reservationserviceModule.v1.ReservationServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.bigquery.reservation.v1.SearchAllAssignmentsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.bigquery.reservation.v1.SearchAllAssignmentsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.bigquery.reservation.v1.Assignment()), + generateSampleMessage(new protos.google.cloud.bigquery.reservation.v1.Assignment()), + generateSampleMessage(new protos.google.cloud.bigquery.reservation.v1.Assignment()), + ]; + client.innerApiCalls.searchAllAssignments = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.searchAllAssignments( + request, + (err?: Error|null, result?: protos.google.cloud.bigquery.reservation.v1.IAssignment[]|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.searchAllAssignments as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.searchAllAssignments as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes searchAllAssignments with error', async () => { + const client = new reservationserviceModule.v1.ReservationServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.bigquery.reservation.v1.SearchAllAssignmentsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.bigquery.reservation.v1.SearchAllAssignmentsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.searchAllAssignments = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.searchAllAssignments(request), expectedError); + const actualRequest = (client.innerApiCalls.searchAllAssignments as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.searchAllAssignments as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes searchAllAssignmentsStream without error', async () => { + const client = new reservationserviceModule.v1.ReservationServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.bigquery.reservation.v1.SearchAllAssignmentsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.bigquery.reservation.v1.SearchAllAssignmentsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.bigquery.reservation.v1.Assignment()), + generateSampleMessage(new protos.google.cloud.bigquery.reservation.v1.Assignment()), + generateSampleMessage(new protos.google.cloud.bigquery.reservation.v1.Assignment()), + ]; + client.descriptors.page.searchAllAssignments.createStream = stubPageStreamingCall(expectedResponse); + const stream = client.searchAllAssignmentsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.bigquery.reservation.v1.Assignment[] = []; + stream.on('data', (response: protos.google.cloud.bigquery.reservation.v1.Assignment) => { + responses.push(response); + }); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + const responses = await promise; + assert.deepStrictEqual(responses, expectedResponse); + assert((client.descriptors.page.searchAllAssignments.createStream as SinonStub) + .getCall(0).calledWith(client.innerApiCalls.searchAllAssignments, request)); + assert( + (client.descriptors.page.searchAllAssignments.createStream as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('invokes searchAllAssignmentsStream with error', async () => { + const client = new reservationserviceModule.v1.ReservationServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.bigquery.reservation.v1.SearchAllAssignmentsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.bigquery.reservation.v1.SearchAllAssignmentsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.descriptors.page.searchAllAssignments.createStream = stubPageStreamingCall(undefined, expectedError); + const stream = client.searchAllAssignmentsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.bigquery.reservation.v1.Assignment[] = []; + stream.on('data', (response: protos.google.cloud.bigquery.reservation.v1.Assignment) => { + responses.push(response); + }); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + await assert.rejects(promise, expectedError); + assert((client.descriptors.page.searchAllAssignments.createStream as SinonStub) + .getCall(0).calledWith(client.innerApiCalls.searchAllAssignments, request)); + assert( + (client.descriptors.page.searchAllAssignments.createStream as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('uses async iteration with searchAllAssignments without error', async () => { + const client = new reservationserviceModule.v1.ReservationServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.bigquery.reservation.v1.SearchAllAssignmentsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.bigquery.reservation.v1.SearchAllAssignmentsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.bigquery.reservation.v1.Assignment()), + generateSampleMessage(new protos.google.cloud.bigquery.reservation.v1.Assignment()), + generateSampleMessage(new protos.google.cloud.bigquery.reservation.v1.Assignment()), + ]; + client.descriptors.page.searchAllAssignments.asyncIterate = stubAsyncIterationCall(expectedResponse); + const responses: protos.google.cloud.bigquery.reservation.v1.IAssignment[] = []; + const iterable = client.searchAllAssignmentsAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + (client.descriptors.page.searchAllAssignments.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert( + (client.descriptors.page.searchAllAssignments.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('uses async iteration with searchAllAssignments with error', async () => { + const client = new reservationserviceModule.v1.ReservationServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.bigquery.reservation.v1.SearchAllAssignmentsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.bigquery.reservation.v1.SearchAllAssignmentsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.descriptors.page.searchAllAssignments.asyncIterate = stubAsyncIterationCall(undefined, expectedError); + const iterable = client.searchAllAssignmentsAsync(request); + await assert.rejects(async () => { + const responses: protos.google.cloud.bigquery.reservation.v1.IAssignment[] = []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + (client.descriptors.page.searchAllAssignments.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert( + (client.descriptors.page.searchAllAssignments.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + }); + + describe('Path templates', () => { + + describe('assignment', () => { + const fakePath = "/rendered/path/assignment"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + reservation: "reservationValue", + assignment: "assignmentValue", + }; + const client = new reservationserviceModule.v1.ReservationServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.assignmentPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.assignmentPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('assignmentPath', () => { + const result = client.assignmentPath("projectValue", "locationValue", "reservationValue", "assignmentValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.assignmentPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromAssignmentName', () => { + const result = client.matchProjectFromAssignmentName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.assignmentPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromAssignmentName', () => { + const result = client.matchLocationFromAssignmentName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.assignmentPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchReservationFromAssignmentName', () => { + const result = client.matchReservationFromAssignmentName(fakePath); + assert.strictEqual(result, "reservationValue"); + assert((client.pathTemplates.assignmentPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchAssignmentFromAssignmentName', () => { + const result = client.matchAssignmentFromAssignmentName(fakePath); + assert.strictEqual(result, "assignmentValue"); + assert((client.pathTemplates.assignmentPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('biReservation', () => { + const fakePath = "/rendered/path/biReservation"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + }; + const client = new reservationserviceModule.v1.ReservationServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.biReservationPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.biReservationPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('biReservationPath', () => { + const result = client.biReservationPath("projectValue", "locationValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.biReservationPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromBiReservationName', () => { + const result = client.matchProjectFromBiReservationName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.biReservationPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromBiReservationName', () => { + const result = client.matchLocationFromBiReservationName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.biReservationPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('capacityCommitment', () => { + const fakePath = "/rendered/path/capacityCommitment"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + capacity_commitment: "capacityCommitmentValue", + }; + const client = new reservationserviceModule.v1.ReservationServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.capacityCommitmentPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.capacityCommitmentPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('capacityCommitmentPath', () => { + const result = client.capacityCommitmentPath("projectValue", "locationValue", "capacityCommitmentValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.capacityCommitmentPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromCapacityCommitmentName', () => { + const result = client.matchProjectFromCapacityCommitmentName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.capacityCommitmentPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromCapacityCommitmentName', () => { + const result = client.matchLocationFromCapacityCommitmentName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.capacityCommitmentPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchCapacityCommitmentFromCapacityCommitmentName', () => { + const result = client.matchCapacityCommitmentFromCapacityCommitmentName(fakePath); + assert.strictEqual(result, "capacityCommitmentValue"); + assert((client.pathTemplates.capacityCommitmentPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('location', () => { + const fakePath = "/rendered/path/location"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + }; + const client = new reservationserviceModule.v1.ReservationServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.locationPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.locationPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('locationPath', () => { + const result = client.locationPath("projectValue", "locationValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.locationPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromLocationName', () => { + const result = client.matchProjectFromLocationName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.locationPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromLocationName', () => { + const result = client.matchLocationFromLocationName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.locationPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('project', () => { + const fakePath = "/rendered/path/project"; + const expectedParameters = { + project: "projectValue", + }; + const client = new reservationserviceModule.v1.ReservationServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectPath', () => { + const result = client.projectPath("projectValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectName', () => { + const result = client.matchProjectFromProjectName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('reservation', () => { + const fakePath = "/rendered/path/reservation"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + reservation: "reservationValue", + }; + const client = new reservationserviceModule.v1.ReservationServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.reservationPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.reservationPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('reservationPath', () => { + const result = client.reservationPath("projectValue", "locationValue", "reservationValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.reservationPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromReservationName', () => { + const result = client.matchProjectFromReservationName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.reservationPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromReservationName', () => { + const result = client.matchLocationFromReservationName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.reservationPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchReservationFromReservationName', () => { + const result = client.matchReservationFromReservationName(fakePath); + assert.strictEqual(result, "reservationValue"); + assert((client.pathTemplates.reservationPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + }); +}); diff --git a/owl-bot-staging/google-cloud-bigquery-reservation/v1/tsconfig.json b/owl-bot-staging/google-cloud-bigquery-reservation/v1/tsconfig.json new file mode 100644 index 00000000000..c78f1c884ef --- /dev/null +++ b/owl-bot-staging/google-cloud-bigquery-reservation/v1/tsconfig.json @@ -0,0 +1,19 @@ +{ + "extends": "./node_modules/gts/tsconfig-google.json", + "compilerOptions": { + "rootDir": ".", + "outDir": "build", + "resolveJsonModule": true, + "lib": [ + "es2018", + "dom" + ] + }, + "include": [ + "src/*.ts", + "src/**/*.ts", + "test/*.ts", + "test/**/*.ts", + "system-test/*.ts" + ] +} diff --git a/owl-bot-staging/google-cloud-bigquery-reservation/v1/webpack.config.js b/owl-bot-staging/google-cloud-bigquery-reservation/v1/webpack.config.js new file mode 100644 index 00000000000..bf29b0f5297 --- /dev/null +++ b/owl-bot-staging/google-cloud-bigquery-reservation/v1/webpack.config.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 +// +// https://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. + +const path = require('path'); + +module.exports = { + entry: './src/index.ts', + output: { + library: 'ReservationService', + filename: './reservation-service.js', + }, + node: { + child_process: 'empty', + fs: 'empty', + crypto: 'empty', + }, + resolve: { + alias: { + '../../../package.json': path.resolve(__dirname, 'package.json'), + }, + extensions: ['.js', '.json', '.ts'], + }, + module: { + rules: [ + { + test: /\.tsx?$/, + use: 'ts-loader', + exclude: /node_modules/ + }, + { + test: /node_modules[\\/]@grpc[\\/]grpc-js/, + use: 'null-loader' + }, + { + test: /node_modules[\\/]grpc/, + use: 'null-loader' + }, + { + test: /node_modules[\\/]retry-request/, + use: 'null-loader' + }, + { + test: /node_modules[\\/]https?-proxy-agent/, + use: 'null-loader' + }, + { + test: /node_modules[\\/]gtoken/, + use: 'null-loader' + }, + ], + }, + mode: 'production', +}; From 5bbf0edeed8b9e2694475b15c3ac85055f978884 Mon Sep 17 00:00:00 2001 From: Owl Bot Date: Wed, 22 Mar 2023 18:16:44 +0000 Subject: [PATCH 2/2] =?UTF-8?q?=F0=9F=A6=89=20Updates=20from=20OwlBot=20po?= =?UTF-8?q?st-processor?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md --- .../v1/.eslintignore | 7 - .../v1/.eslintrc.json | 3 - .../v1/.gitignore | 14 - .../v1/.jsdoc.js | 55 - .../v1/.mocharc.js | 33 - .../v1/.prettierrc.js | 22 - .../v1/README.md | 1 - .../v1/linkinator.config.json | 16 - .../v1/package.json | 64 - .../bigquery/reservation/v1/reservation.proto | 1171 ------ .../reservation_service.create_assignment.js | 73 - ...tion_service.create_capacity_commitment.js | 79 - .../reservation_service.create_reservation.js | 72 - .../reservation_service.delete_assignment.js | 62 - ...tion_service.delete_capacity_commitment.js | 68 - .../reservation_service.delete_reservation.js | 62 - .../reservation_service.get_bi_reservation.js | 62 - ...rvation_service.get_capacity_commitment.js | 62 - .../v1/reservation_service.get_reservation.js | 62 - .../reservation_service.list_assignments.js | 74 - ...ation_service.list_capacity_commitments.js | 72 - .../reservation_service.list_reservations.js | 72 - ...tion_service.merge_capacity_commitments.js | 69 - .../v1/reservation_service.move_assignment.js | 75 - ...ervation_service.search_all_assignments.js | 81 - .../reservation_service.search_assignments.js | 81 - ...ation_service.split_capacity_commitment.js | 66 - .../reservation_service.update_assignment.js | 64 - ...servation_service.update_bi_reservation.js | 64 - ...tion_service.update_capacity_commitment.js | 64 - .../reservation_service.update_reservation.js | 64 - ....google.cloud.bigquery.reservation.v1.json | 967 ----- .../v1/src/index.ts | 25 - .../v1/src/v1/gapic_metadata.json | 253 -- .../v1/src/v1/index.ts | 19 - .../v1/src/v1/reservation_service_client.ts | 2924 -------------- .../v1/reservation_service_client_config.json | 129 - .../v1/reservation_service_proto_list.json | 3 - .../system-test/fixtures/sample/src/index.js | 27 - .../system-test/fixtures/sample/src/index.ts | 32 - .../v1/system-test/install.ts | 49 - .../v1/test/gapic_reservation_service_v1.ts | 3435 ----------------- .../v1/tsconfig.json | 19 - .../v1/webpack.config.js | 64 - .../bigquery/reservation/v1/reservation.proto | 242 +- .../protos/protos.d.ts | 148 +- .../protos/protos.js | 495 +++ .../protos/protos.json | 51 +- .../v1/reservation_service.move_assignment.js | 7 + ...ervation_service.search_all_assignments.js | 4 +- .../reservation_service.search_assignments.js | 4 +- ....google.cloud.bigquery.reservation.v1.json | 8 +- .../src/v1/reservation_service_client.ts | 30 +- 53 files changed, 904 insertions(+), 10865 deletions(-) delete mode 100644 owl-bot-staging/google-cloud-bigquery-reservation/v1/.eslintignore delete mode 100644 owl-bot-staging/google-cloud-bigquery-reservation/v1/.eslintrc.json delete mode 100644 owl-bot-staging/google-cloud-bigquery-reservation/v1/.gitignore delete mode 100644 owl-bot-staging/google-cloud-bigquery-reservation/v1/.jsdoc.js delete mode 100644 owl-bot-staging/google-cloud-bigquery-reservation/v1/.mocharc.js delete mode 100644 owl-bot-staging/google-cloud-bigquery-reservation/v1/.prettierrc.js delete mode 100644 owl-bot-staging/google-cloud-bigquery-reservation/v1/README.md delete mode 100644 owl-bot-staging/google-cloud-bigquery-reservation/v1/linkinator.config.json delete mode 100644 owl-bot-staging/google-cloud-bigquery-reservation/v1/package.json delete mode 100644 owl-bot-staging/google-cloud-bigquery-reservation/v1/protos/google/cloud/bigquery/reservation/v1/reservation.proto delete mode 100644 owl-bot-staging/google-cloud-bigquery-reservation/v1/samples/generated/v1/reservation_service.create_assignment.js delete mode 100644 owl-bot-staging/google-cloud-bigquery-reservation/v1/samples/generated/v1/reservation_service.create_capacity_commitment.js delete mode 100644 owl-bot-staging/google-cloud-bigquery-reservation/v1/samples/generated/v1/reservation_service.create_reservation.js delete mode 100644 owl-bot-staging/google-cloud-bigquery-reservation/v1/samples/generated/v1/reservation_service.delete_assignment.js delete mode 100644 owl-bot-staging/google-cloud-bigquery-reservation/v1/samples/generated/v1/reservation_service.delete_capacity_commitment.js delete mode 100644 owl-bot-staging/google-cloud-bigquery-reservation/v1/samples/generated/v1/reservation_service.delete_reservation.js delete mode 100644 owl-bot-staging/google-cloud-bigquery-reservation/v1/samples/generated/v1/reservation_service.get_bi_reservation.js delete mode 100644 owl-bot-staging/google-cloud-bigquery-reservation/v1/samples/generated/v1/reservation_service.get_capacity_commitment.js delete mode 100644 owl-bot-staging/google-cloud-bigquery-reservation/v1/samples/generated/v1/reservation_service.get_reservation.js delete mode 100644 owl-bot-staging/google-cloud-bigquery-reservation/v1/samples/generated/v1/reservation_service.list_assignments.js delete mode 100644 owl-bot-staging/google-cloud-bigquery-reservation/v1/samples/generated/v1/reservation_service.list_capacity_commitments.js delete mode 100644 owl-bot-staging/google-cloud-bigquery-reservation/v1/samples/generated/v1/reservation_service.list_reservations.js delete mode 100644 owl-bot-staging/google-cloud-bigquery-reservation/v1/samples/generated/v1/reservation_service.merge_capacity_commitments.js delete mode 100644 owl-bot-staging/google-cloud-bigquery-reservation/v1/samples/generated/v1/reservation_service.move_assignment.js delete mode 100644 owl-bot-staging/google-cloud-bigquery-reservation/v1/samples/generated/v1/reservation_service.search_all_assignments.js delete mode 100644 owl-bot-staging/google-cloud-bigquery-reservation/v1/samples/generated/v1/reservation_service.search_assignments.js delete mode 100644 owl-bot-staging/google-cloud-bigquery-reservation/v1/samples/generated/v1/reservation_service.split_capacity_commitment.js delete mode 100644 owl-bot-staging/google-cloud-bigquery-reservation/v1/samples/generated/v1/reservation_service.update_assignment.js delete mode 100644 owl-bot-staging/google-cloud-bigquery-reservation/v1/samples/generated/v1/reservation_service.update_bi_reservation.js delete mode 100644 owl-bot-staging/google-cloud-bigquery-reservation/v1/samples/generated/v1/reservation_service.update_capacity_commitment.js delete mode 100644 owl-bot-staging/google-cloud-bigquery-reservation/v1/samples/generated/v1/reservation_service.update_reservation.js delete mode 100644 owl-bot-staging/google-cloud-bigquery-reservation/v1/samples/generated/v1/snippet_metadata.google.cloud.bigquery.reservation.v1.json delete mode 100644 owl-bot-staging/google-cloud-bigquery-reservation/v1/src/index.ts delete mode 100644 owl-bot-staging/google-cloud-bigquery-reservation/v1/src/v1/gapic_metadata.json delete mode 100644 owl-bot-staging/google-cloud-bigquery-reservation/v1/src/v1/index.ts delete mode 100644 owl-bot-staging/google-cloud-bigquery-reservation/v1/src/v1/reservation_service_client.ts delete mode 100644 owl-bot-staging/google-cloud-bigquery-reservation/v1/src/v1/reservation_service_client_config.json delete mode 100644 owl-bot-staging/google-cloud-bigquery-reservation/v1/src/v1/reservation_service_proto_list.json delete mode 100644 owl-bot-staging/google-cloud-bigquery-reservation/v1/system-test/fixtures/sample/src/index.js delete mode 100644 owl-bot-staging/google-cloud-bigquery-reservation/v1/system-test/fixtures/sample/src/index.ts delete mode 100644 owl-bot-staging/google-cloud-bigquery-reservation/v1/system-test/install.ts delete mode 100644 owl-bot-staging/google-cloud-bigquery-reservation/v1/test/gapic_reservation_service_v1.ts delete mode 100644 owl-bot-staging/google-cloud-bigquery-reservation/v1/tsconfig.json delete mode 100644 owl-bot-staging/google-cloud-bigquery-reservation/v1/webpack.config.js diff --git a/owl-bot-staging/google-cloud-bigquery-reservation/v1/.eslintignore b/owl-bot-staging/google-cloud-bigquery-reservation/v1/.eslintignore deleted file mode 100644 index cfc348ec4d1..00000000000 --- a/owl-bot-staging/google-cloud-bigquery-reservation/v1/.eslintignore +++ /dev/null @@ -1,7 +0,0 @@ -**/node_modules -**/.coverage -build/ -docs/ -protos/ -system-test/ -samples/generated/ diff --git a/owl-bot-staging/google-cloud-bigquery-reservation/v1/.eslintrc.json b/owl-bot-staging/google-cloud-bigquery-reservation/v1/.eslintrc.json deleted file mode 100644 index 78215349546..00000000000 --- a/owl-bot-staging/google-cloud-bigquery-reservation/v1/.eslintrc.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "extends": "./node_modules/gts" -} diff --git a/owl-bot-staging/google-cloud-bigquery-reservation/v1/.gitignore b/owl-bot-staging/google-cloud-bigquery-reservation/v1/.gitignore deleted file mode 100644 index d4f03a0df2e..00000000000 --- a/owl-bot-staging/google-cloud-bigquery-reservation/v1/.gitignore +++ /dev/null @@ -1,14 +0,0 @@ -**/*.log -**/node_modules -/.coverage -/coverage -/.nyc_output -/docs/ -/out/ -/build/ -system-test/secrets.js -system-test/*key.json -*.lock -.DS_Store -package-lock.json -__pycache__ diff --git a/owl-bot-staging/google-cloud-bigquery-reservation/v1/.jsdoc.js b/owl-bot-staging/google-cloud-bigquery-reservation/v1/.jsdoc.js deleted file mode 100644 index 7feca2a65aa..00000000000 --- a/owl-bot-staging/google-cloud-bigquery-reservation/v1/.jsdoc.js +++ /dev/null @@ -1,55 +0,0 @@ -// Copyright 2023 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 -// -// https://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. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - -'use strict'; - -module.exports = { - opts: { - readme: './README.md', - package: './package.json', - template: './node_modules/jsdoc-fresh', - recurse: true, - verbose: true, - destination: './docs/' - }, - plugins: [ - 'plugins/markdown', - 'jsdoc-region-tag' - ], - source: { - excludePattern: '(^|\\/|\\\\)[._]', - include: [ - 'build/src', - 'protos' - ], - includePattern: '\\.js$' - }, - templates: { - copyright: 'Copyright 2023 Google LLC', - includeDate: false, - sourceFiles: false, - systemName: '@google-cloud/bigquery-reservation', - theme: 'lumen', - default: { - outputSourceFiles: false - } - }, - markdown: { - idInHeadings: true - } -}; diff --git a/owl-bot-staging/google-cloud-bigquery-reservation/v1/.mocharc.js b/owl-bot-staging/google-cloud-bigquery-reservation/v1/.mocharc.js deleted file mode 100644 index 1a38f257db7..00000000000 --- a/owl-bot-staging/google-cloud-bigquery-reservation/v1/.mocharc.js +++ /dev/null @@ -1,33 +0,0 @@ -// Copyright 2023 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 -// -// https://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. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - -const config = { - "enable-source-maps": true, - "throw-deprecation": true, - "timeout": 10000 -} -if (process.env.MOCHA_THROW_DEPRECATION === 'false') { - delete config['throw-deprecation']; -} -if (process.env.MOCHA_REPORTER) { - config.reporter = process.env.MOCHA_REPORTER; -} -if (process.env.MOCHA_REPORTER_OUTPUT) { - config['reporter-option'] = `output=${process.env.MOCHA_REPORTER_OUTPUT}`; -} -module.exports = config diff --git a/owl-bot-staging/google-cloud-bigquery-reservation/v1/.prettierrc.js b/owl-bot-staging/google-cloud-bigquery-reservation/v1/.prettierrc.js deleted file mode 100644 index 55639e70f9e..00000000000 --- a/owl-bot-staging/google-cloud-bigquery-reservation/v1/.prettierrc.js +++ /dev/null @@ -1,22 +0,0 @@ -// Copyright 2023 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 -// -// https://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. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - - -module.exports = { - ...require('gts/.prettierrc.json') -} diff --git a/owl-bot-staging/google-cloud-bigquery-reservation/v1/README.md b/owl-bot-staging/google-cloud-bigquery-reservation/v1/README.md deleted file mode 100644 index 03e19927b99..00000000000 --- a/owl-bot-staging/google-cloud-bigquery-reservation/v1/README.md +++ /dev/null @@ -1 +0,0 @@ -Reservation: Nodejs Client diff --git a/owl-bot-staging/google-cloud-bigquery-reservation/v1/linkinator.config.json b/owl-bot-staging/google-cloud-bigquery-reservation/v1/linkinator.config.json deleted file mode 100644 index befd23c8633..00000000000 --- a/owl-bot-staging/google-cloud-bigquery-reservation/v1/linkinator.config.json +++ /dev/null @@ -1,16 +0,0 @@ -{ - "recurse": true, - "skip": [ - "https://codecov.io/gh/googleapis/", - "www.googleapis.com", - "img.shields.io", - "https://console.cloud.google.com/cloudshell", - "https://support.google.com" - ], - "silent": true, - "concurrency": 5, - "retry": true, - "retryErrors": true, - "retryErrorsCount": 5, - "retryErrorsJitter": 3000 -} diff --git a/owl-bot-staging/google-cloud-bigquery-reservation/v1/package.json b/owl-bot-staging/google-cloud-bigquery-reservation/v1/package.json deleted file mode 100644 index 09514ddcbe1..00000000000 --- a/owl-bot-staging/google-cloud-bigquery-reservation/v1/package.json +++ /dev/null @@ -1,64 +0,0 @@ -{ - "name": "@google-cloud/bigquery-reservation", - "version": "0.1.0", - "description": "Reservation client for Node.js", - "repository": "googleapis/nodejs-reservation", - "license": "Apache-2.0", - "author": "Google LLC", - "main": "build/src/index.js", - "files": [ - "build/src", - "build/protos" - ], - "keywords": [ - "google apis client", - "google api client", - "google apis", - "google api", - "google", - "google cloud platform", - "google cloud", - "cloud", - "google reservation", - "reservation", - "reservation service" - ], - "scripts": { - "clean": "gts clean", - "compile": "tsc -p . && cp -r protos build/ && minifyProtoJson", - "compile-protos": "compileProtos src", - "docs": "jsdoc -c .jsdoc.js", - "predocs-test": "npm run docs", - "docs-test": "linkinator docs", - "fix": "gts fix", - "lint": "gts check", - "prepare": "npm run compile-protos && npm run compile", - "system-test": "c8 mocha build/system-test", - "test": "c8 mocha build/test" - }, - "dependencies": { - "google-gax": "^3.5.7" - }, - "devDependencies": { - "@types/mocha": "^10.0.1", - "@types/node": "^18.11.18", - "@types/sinon": "^10.0.13", - "c8": "^7.12.0", - "gts": "^3.1.1", - "jsdoc": "^4.0.0", - "jsdoc-fresh": "^2.0.1", - "jsdoc-region-tag": "^2.0.1", - "linkinator": "^4.1.2", - "mocha": "^10.2.0", - "null-loader": "^4.0.1", - "pack-n-play": "^1.0.0-2", - "sinon": "^15.0.1", - "ts-loader": "^8.4.0", - "typescript": "^4.8.4", - "webpack": "^4.46.0", - "webpack-cli": "^4.10.0" - }, - "engines": { - "node": ">=v12" - } -} diff --git a/owl-bot-staging/google-cloud-bigquery-reservation/v1/protos/google/cloud/bigquery/reservation/v1/reservation.proto b/owl-bot-staging/google-cloud-bigquery-reservation/v1/protos/google/cloud/bigquery/reservation/v1/reservation.proto deleted file mode 100644 index 6be4b70a0e1..00000000000 --- a/owl-bot-staging/google-cloud-bigquery-reservation/v1/protos/google/cloud/bigquery/reservation/v1/reservation.proto +++ /dev/null @@ -1,1171 +0,0 @@ -// Copyright 2023 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. - -syntax = "proto3"; - -package google.cloud.bigquery.reservation.v1; - -import "google/api/annotations.proto"; -import "google/api/client.proto"; -import "google/api/field_behavior.proto"; -import "google/api/resource.proto"; -import "google/protobuf/empty.proto"; -import "google/protobuf/field_mask.proto"; -import "google/protobuf/timestamp.proto"; -import "google/rpc/status.proto"; - -option csharp_namespace = "Google.Cloud.BigQuery.Reservation.V1"; -option go_package = "cloud.google.com/go/bigquery/reservation/apiv1/reservationpb;reservationpb"; -option java_multiple_files = true; -option java_outer_classname = "ReservationProto"; -option java_package = "com.google.cloud.bigquery.reservation.v1"; -option php_namespace = "Google\\Cloud\\BigQuery\\Reservation\\V1"; - -// This API allows users to manage their flat-rate BigQuery reservations. -// -// A reservation provides computational resource guarantees, in the form of -// [slots](https://cloud.google.com/bigquery/docs/slots), to users. A slot is a -// unit of computational power in BigQuery, and serves as the basic unit of -// parallelism. In a scan of a multi-partitioned table, a single slot operates -// on a single partition of the table. A reservation resource exists as a child -// resource of the admin project and location, e.g.: -// `projects/myproject/locations/US/reservations/reservationName`. -// -// A capacity commitment is a way to purchase compute capacity for BigQuery jobs -// (in the form of slots) with some committed period of usage. A capacity -// commitment resource exists as a child resource of the admin project and -// location, e.g.: -// `projects/myproject/locations/US/capacityCommitments/id`. -service ReservationService { - option (google.api.default_host) = "bigqueryreservation.googleapis.com"; - option (google.api.oauth_scopes) = - "https://www.googleapis.com/auth/bigquery," - "https://www.googleapis.com/auth/cloud-platform"; - - // Creates a new reservation resource. - rpc CreateReservation(CreateReservationRequest) returns (Reservation) { - option (google.api.http) = { - post: "/v1/{parent=projects/*/locations/*}/reservations" - body: "reservation" - }; - option (google.api.method_signature) = "parent,reservation,reservation_id"; - } - - // Lists all the reservations for the project in the specified location. - rpc ListReservations(ListReservationsRequest) - returns (ListReservationsResponse) { - option (google.api.http) = { - get: "/v1/{parent=projects/*/locations/*}/reservations" - }; - option (google.api.method_signature) = "parent"; - } - - // Returns information about the reservation. - rpc GetReservation(GetReservationRequest) returns (Reservation) { - option (google.api.http) = { - get: "/v1/{name=projects/*/locations/*/reservations/*}" - }; - option (google.api.method_signature) = "name"; - } - - // Deletes a reservation. - // Returns `google.rpc.Code.FAILED_PRECONDITION` when reservation has - // assignments. - rpc DeleteReservation(DeleteReservationRequest) - returns (google.protobuf.Empty) { - option (google.api.http) = { - delete: "/v1/{name=projects/*/locations/*/reservations/*}" - }; - option (google.api.method_signature) = "name"; - } - - // Updates an existing reservation resource. - rpc UpdateReservation(UpdateReservationRequest) returns (Reservation) { - option (google.api.http) = { - patch: "/v1/{reservation.name=projects/*/locations/*/reservations/*}" - body: "reservation" - }; - option (google.api.method_signature) = "reservation,update_mask"; - } - - // Creates a new capacity commitment resource. - rpc CreateCapacityCommitment(CreateCapacityCommitmentRequest) - returns (CapacityCommitment) { - option (google.api.http) = { - post: "/v1/{parent=projects/*/locations/*}/capacityCommitments" - body: "capacity_commitment" - }; - option (google.api.method_signature) = "parent,capacity_commitment"; - } - - // Lists all the capacity commitments for the admin project. - rpc ListCapacityCommitments(ListCapacityCommitmentsRequest) - returns (ListCapacityCommitmentsResponse) { - option (google.api.http) = { - get: "/v1/{parent=projects/*/locations/*}/capacityCommitments" - }; - option (google.api.method_signature) = "parent"; - } - - // Returns information about the capacity commitment. - rpc GetCapacityCommitment(GetCapacityCommitmentRequest) - returns (CapacityCommitment) { - option (google.api.http) = { - get: "/v1/{name=projects/*/locations/*/capacityCommitments/*}" - }; - option (google.api.method_signature) = "name"; - } - - // Deletes a capacity commitment. Attempting to delete capacity commitment - // before its commitment_end_time will fail with the error code - // `google.rpc.Code.FAILED_PRECONDITION`. - rpc DeleteCapacityCommitment(DeleteCapacityCommitmentRequest) - returns (google.protobuf.Empty) { - option (google.api.http) = { - delete: "/v1/{name=projects/*/locations/*/capacityCommitments/*}" - }; - option (google.api.method_signature) = "name"; - } - - // Updates an existing capacity commitment. - // - // Only `plan` and `renewal_plan` fields can be updated. - // - // Plan can only be changed to a plan of a longer commitment period. - // Attempting to change to a plan with shorter commitment period will fail - // with the error code `google.rpc.Code.FAILED_PRECONDITION`. - rpc UpdateCapacityCommitment(UpdateCapacityCommitmentRequest) - returns (CapacityCommitment) { - option (google.api.http) = { - patch: "/v1/{capacity_commitment.name=projects/*/locations/*/capacityCommitments/*}" - body: "capacity_commitment" - }; - option (google.api.method_signature) = "capacity_commitment,update_mask"; - } - - // Splits capacity commitment to two commitments of the same plan and - // `commitment_end_time`. - // - // A common use case is to enable downgrading commitments. - // - // For example, in order to downgrade from 10000 slots to 8000, you might - // split a 10000 capacity commitment into commitments of 2000 and 8000. Then, - // you delete the first one after the commitment end time passes. - rpc SplitCapacityCommitment(SplitCapacityCommitmentRequest) - returns (SplitCapacityCommitmentResponse) { - option (google.api.http) = { - post: "/v1/{name=projects/*/locations/*/capacityCommitments/*}:split" - body: "*" - }; - option (google.api.method_signature) = "name,slot_count"; - } - - // Merges capacity commitments of the same plan into a single commitment. - // - // The resulting capacity commitment has the greater commitment_end_time - // out of the to-be-merged capacity commitments. - // - // Attempting to merge capacity commitments of different plan will fail - // with the error code `google.rpc.Code.FAILED_PRECONDITION`. - rpc MergeCapacityCommitments(MergeCapacityCommitmentsRequest) - returns (CapacityCommitment) { - option (google.api.http) = { - post: "/v1/{parent=projects/*/locations/*}/capacityCommitments:merge" - body: "*" - }; - option (google.api.method_signature) = "parent,capacity_commitment_ids"; - } - - // Creates an assignment object which allows the given project to submit jobs - // of a certain type using slots from the specified reservation. - // - // Currently a - // resource (project, folder, organization) can only have one assignment per - // each (job_type, location) combination, and that reservation will be used - // for all jobs of the matching type. - // - // Different assignments can be created on different levels of the - // projects, folders or organization hierarchy. During query execution, - // the assignment is looked up at the project, folder and organization levels - // in that order. The first assignment found is applied to the query. - // - // When creating assignments, it does not matter if other assignments exist at - // higher levels. - // - // Example: - // - // * The organization `organizationA` contains two projects, `project1` - // and `project2`. - // * Assignments for all three entities (`organizationA`, `project1`, and - // `project2`) could all be created and mapped to the same or different - // reservations. - // - // "None" assignments represent an absence of the assignment. Projects - // assigned to None use on-demand pricing. To create a "None" assignment, use - // "none" as a reservation_id in the parent. Example parent: - // `projects/myproject/locations/US/reservations/none`. - // - // Returns `google.rpc.Code.PERMISSION_DENIED` if user does not have - // 'bigquery.admin' permissions on the project using the reservation - // and the project that owns this reservation. - // - // Returns `google.rpc.Code.INVALID_ARGUMENT` when location of the assignment - // does not match location of the reservation. - rpc CreateAssignment(CreateAssignmentRequest) returns (Assignment) { - option (google.api.http) = { - post: "/v1/{parent=projects/*/locations/*/reservations/*}/assignments" - body: "assignment" - }; - option (google.api.method_signature) = "parent,assignment"; - } - - // Lists assignments. - // - // Only explicitly created assignments will be returned. - // - // Example: - // - // * Organization `organizationA` contains two projects, `project1` and - // `project2`. - // * Reservation `res1` exists and was created previously. - // * CreateAssignment was used previously to define the following - // associations between entities and reservations: `` - // and `` - // - // In this example, ListAssignments will just return the above two assignments - // for reservation `res1`, and no expansion/merge will happen. - // - // The wildcard "-" can be used for - // reservations in the request. In that case all assignments belongs to the - // specified project and location will be listed. - // - // **Note** "-" cannot be used for projects nor locations. - rpc ListAssignments(ListAssignmentsRequest) - returns (ListAssignmentsResponse) { - option (google.api.http) = { - get: "/v1/{parent=projects/*/locations/*/reservations/*}/assignments" - }; - option (google.api.method_signature) = "parent"; - } - - // Deletes a assignment. No expansion will happen. - // - // Example: - // - // * Organization `organizationA` contains two projects, `project1` and - // `project2`. - // * Reservation `res1` exists and was created previously. - // * CreateAssignment was used previously to define the following - // associations between entities and reservations: `` - // and `` - // - // In this example, deletion of the `` assignment won't - // affect the other assignment ``. After said deletion, - // queries from `project1` will still use `res1` while queries from - // `project2` will switch to use on-demand mode. - rpc DeleteAssignment(DeleteAssignmentRequest) - returns (google.protobuf.Empty) { - option (google.api.http) = { - delete: "/v1/{name=projects/*/locations/*/reservations/*/assignments/*}" - }; - option (google.api.method_signature) = "name"; - } - - // Deprecated: Looks up assignments for a specified resource for a particular - // region. If the request is about a project: - // - // 1. Assignments created on the project will be returned if they exist. - // 2. Otherwise assignments created on the closest ancestor will be - // returned. - // 3. Assignments for different JobTypes will all be returned. - // - // The same logic applies if the request is about a folder. - // - // If the request is about an organization, then assignments created on the - // organization will be returned (organization doesn't have ancestors). - // - // Comparing to ListAssignments, there are some behavior - // differences: - // - // 1. permission on the assignee will be verified in this API. - // 2. Hierarchy lookup (project->folder->organization) happens in this API. - // 3. Parent here is `projects/*/locations/*`, instead of - // `projects/*/locations/*reservations/*`. - // - // **Note** "-" cannot be used for projects - // nor locations. - rpc SearchAssignments(SearchAssignmentsRequest) - returns (SearchAssignmentsResponse) { - option deprecated = true; - option (google.api.http) = { - get: "/v1/{parent=projects/*/locations/*}:searchAssignments" - }; - option (google.api.method_signature) = "parent,query"; - } - - // Looks up assignments for a specified resource for a particular region. - // If the request is about a project: - // - // 1. Assignments created on the project will be returned if they exist. - // 2. Otherwise assignments created on the closest ancestor will be - // returned. - // 3. Assignments for different JobTypes will all be returned. - // - // The same logic applies if the request is about a folder. - // - // If the request is about an organization, then assignments created on the - // organization will be returned (organization doesn't have ancestors). - // - // Comparing to ListAssignments, there are some behavior - // differences: - // - // 1. permission on the assignee will be verified in this API. - // 2. Hierarchy lookup (project->folder->organization) happens in this API. - // 3. Parent here is `projects/*/locations/*`, instead of - // `projects/*/locations/*reservations/*`. - rpc SearchAllAssignments(SearchAllAssignmentsRequest) - returns (SearchAllAssignmentsResponse) { - option (google.api.http) = { - get: "/v1/{parent=projects/*/locations/*}:searchAllAssignments" - }; - option (google.api.method_signature) = "parent,query"; - } - - // Moves an assignment under a new reservation. - // - // This differs from removing an existing assignment and recreating a new one - // by providing a transactional change that ensures an assignee always has an - // associated reservation. - rpc MoveAssignment(MoveAssignmentRequest) returns (Assignment) { - option (google.api.http) = { - post: "/v1/{name=projects/*/locations/*/reservations/*/assignments/*}:move" - body: "*" - }; - option (google.api.method_signature) = "name,destination_id"; - } - - // Updates an existing assignment. - // - // Only the `priority` field can be updated. - rpc UpdateAssignment(UpdateAssignmentRequest) returns (Assignment) { - option (google.api.http) = { - patch: "/v1/{assignment.name=projects/*/locations/*/reservations/*/assignments/*}" - body: "assignment" - }; - option (google.api.method_signature) = "assignment,update_mask"; - } - - // Retrieves a BI reservation. - rpc GetBiReservation(GetBiReservationRequest) returns (BiReservation) { - option (google.api.http) = { - get: "/v1/{name=projects/*/locations/*/biReservation}" - }; - option (google.api.method_signature) = "name"; - } - - // Updates a BI reservation. - // - // Only fields specified in the `field_mask` are updated. - // - // A singleton BI reservation always exists with default size 0. - // In order to reserve BI capacity it needs to be updated to an amount - // greater than 0. In order to release BI capacity reservation size - // must be set to 0. - rpc UpdateBiReservation(UpdateBiReservationRequest) returns (BiReservation) { - option (google.api.http) = { - patch: "/v1/{bi_reservation.name=projects/*/locations/*/biReservation}" - body: "bi_reservation" - }; - option (google.api.method_signature) = "bi_reservation,update_mask"; - } -} - -// A reservation is a mechanism used to guarantee slots to users. -message Reservation { - option (google.api.resource) = { - type: "bigqueryreservation.googleapis.com/Reservation" - pattern: "projects/{project}/locations/{location}/reservations/{reservation}" - }; - - // Auto scaling settings. - message Autoscale { - // Output only. The slot capacity added to this reservation when autoscale - // happens. Will be between [0, max_slots]. - int64 current_slots = 1 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Number of slots to be scaled when needed. - int64 max_slots = 2; - } - - // The resource name of the reservation, e.g., - // `projects/*/locations/*/reservations/team1-prod`. - // The reservation_id must only contain lower case alphanumeric characters or - // dashes. It must start with a letter and must not end with a dash. Its - // maximum length is 64 characters. - string name = 1; - - // Minimum slots available to this reservation. A slot is a unit of - // computational power in BigQuery, and serves as the unit of parallelism. - // - // Queries using this reservation might use more slots during runtime if - // ignore_idle_slots is set to false. - // - // If total slot_capacity of the reservation and its siblings - // exceeds the total slot_count of all capacity commitments, the request will - // fail with `google.rpc.Code.RESOURCE_EXHAUSTED`. - // - // - // NOTE: for reservations in US or EU multi-regions, slot capacity constraints - // are checked separately for default and auxiliary regions. See - // multi_region_auxiliary flag for more details. - int64 slot_capacity = 2; - - // If false, any query or pipeline job using this reservation will use idle - // slots from other reservations within the same admin project. If true, a - // query or pipeline job using this reservation will execute with the slot - // capacity specified in the slot_capacity field at most. - bool ignore_idle_slots = 4; - - // The configuration parameters for the auto scaling feature. Note this is an - // alpha feature. - Autoscale autoscale = 7; - - // Job concurrency target which sets a soft upper bound on the number of jobs - // that can run concurrently in this reservation. This is a soft target due to - // asynchronous nature of the system and various optimizations for small - // queries. - // Default value is 0 which means that concurrency target will be - // automatically computed by the system. - // NOTE: this field is exposed as `target_job_concurrency` in the Information - // Schema, DDL and BQ CLI. - int64 concurrency = 16; - - // Output only. Creation time of the reservation. - google.protobuf.Timestamp creation_time = 8 - [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. Last update time of the reservation. - google.protobuf.Timestamp update_time = 9 - [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Applicable only for reservations located within one of the BigQuery - // multi-regions (US or EU). - // - // If set to true, this reservation is placed in the organization's - // secondary region which is designated for disaster recovery purposes. - // If false, this reservation is placed in the organization's default region. - bool multi_region_auxiliary = 14; - - // Edition of the reservation. - Edition edition = 17; -} - -// Capacity commitment is a way to purchase compute capacity for BigQuery jobs -// (in the form of slots) with some committed period of usage. Annual -// commitments renew by default. Commitments can be removed after their -// commitment end time passes. -// -// In order to remove annual commitment, its plan needs to be changed -// to monthly or flex first. -// -// A capacity commitment resource exists as a child resource of the admin -// project. -message CapacityCommitment { - option (google.api.resource) = { - type: "bigqueryreservation.googleapis.com/CapacityCommitment" - pattern: "projects/{project}/locations/{location}/capacityCommitments/{capacity_commitment}" - }; - - // Commitment plan defines the current committed period. Capacity commitment - // cannot be deleted during it's committed period. - enum CommitmentPlan { - // Invalid plan value. Requests with this value will be rejected with - // error code `google.rpc.Code.INVALID_ARGUMENT`. - COMMITMENT_PLAN_UNSPECIFIED = 0; - - // Flex commitments have committed period of 1 minute after becoming ACTIVE. - // After that, they are not in a committed period anymore and can be removed - // any time. - FLEX = 3; - - // Same as FLEX, should only be used if flat-rate commitments are still - // available. - FLEX_FLAT_RATE = 7; - - // Trial commitments have a committed period of 182 days after becoming - // ACTIVE. After that, they are converted to a new commitment based on the - // `renewal_plan`. Default `renewal_plan` for Trial commitment is Flex so - // that it can be deleted right after committed period ends. - TRIAL = 5; - - // Monthly commitments have a committed period of 30 days after becoming - // ACTIVE. After that, they are not in a committed period anymore and can be - // removed any time. - MONTHLY = 2; - - // Same as MONTHLY, should only be used if flat-rate commitments are still - // available. - MONTHLY_FLAT_RATE = 8; - - // Annual commitments have a committed period of 365 days after becoming - // ACTIVE. After that they are converted to a new commitment based on the - // renewal_plan. - ANNUAL = 4; - - // Same as ANNUAL, should only be used if flat-rate commitments are still - // available. - ANNUAL_FLAT_RATE = 9; - - // 3-year commitments have a committed period of 1095(3 * 365) days after - // becoming ACTIVE. After that they are converted to a new commitment based - // on the renewal_plan. - THREE_YEAR = 10; - - // Should only be used for `renewal_plan` and is only meaningful if - // edition is specified to values other than EDITION_UNSPECIFIED. Otherwise - // CreateCapacityCommitmentRequest or UpdateCapacityCommitmentRequest will - // be rejected with error code `google.rpc.Code.INVALID_ARGUMENT`. If the - // renewal_plan is NONE, capacity commitment will be removed at the end of - // its commitment period. - NONE = 6; - } - - // Capacity commitment can either become ACTIVE right away or transition - // from PENDING to ACTIVE or FAILED. - enum State { - // Invalid state value. - STATE_UNSPECIFIED = 0; - - // Capacity commitment is pending provisioning. Pending capacity commitment - // does not contribute to the project's slot_capacity. - PENDING = 1; - - // Once slots are provisioned, capacity commitment becomes active. - // slot_count is added to the project's slot_capacity. - ACTIVE = 2; - - // Capacity commitment is failed to be activated by the backend. - FAILED = 3; - } - - // Output only. The resource name of the capacity commitment, e.g., - // `projects/myproject/locations/US/capacityCommitments/123` - // The commitment_id must only contain lower case alphanumeric characters or - // dashes. It must start with a letter and must not end - // with a dash. Its maximum length is 64 characters. - string name = 1 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Number of slots in this commitment. - int64 slot_count = 2; - - // Capacity commitment commitment plan. - CommitmentPlan plan = 3; - - // Output only. State of the commitment. - State state = 4 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. The start of the current commitment period. It is applicable - // only for ACTIVE capacity commitments. - google.protobuf.Timestamp commitment_start_time = 9 - [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. The end of the current commitment period. It is applicable - // only for ACTIVE capacity commitments. - google.protobuf.Timestamp commitment_end_time = 5 - [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. For FAILED commitment plan, provides the reason of failure. - google.rpc.Status failure_status = 7 - [(google.api.field_behavior) = OUTPUT_ONLY]; - - // The plan this capacity commitment is converted to after commitment_end_time - // passes. Once the plan is changed, committed period is extended according to - // commitment plan. Only applicable for ANNUAL and TRIAL commitments. - CommitmentPlan renewal_plan = 8; - - // Applicable only for commitments located within one of the BigQuery - // multi-regions (US or EU). - // - // If set to true, this commitment is placed in the organization's - // secondary region which is designated for disaster recovery purposes. - // If false, this commitment is placed in the organization's default region. - bool multi_region_auxiliary = 10; - - // Edition of the capacity commitment. - Edition edition = 12; -} - -// The request for -// [ReservationService.CreateReservation][google.cloud.bigquery.reservation.v1.ReservationService.CreateReservation]. -message CreateReservationRequest { - // Required. Project, location. E.g., - // `projects/myproject/locations/US` - string parent = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - child_type: "bigqueryreservation.googleapis.com/Reservation" - } - ]; - - // The reservation ID. It must only contain lower case alphanumeric - // characters or dashes. It must start with a letter and must not end - // with a dash. Its maximum length is 64 characters. - string reservation_id = 2; - - // Definition of the new reservation to create. - Reservation reservation = 3; -} - -// The request for -// [ReservationService.ListReservations][google.cloud.bigquery.reservation.v1.ReservationService.ListReservations]. -message ListReservationsRequest { - // Required. The parent resource name containing project and location, e.g.: - // `projects/myproject/locations/US` - string parent = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - child_type: "bigqueryreservation.googleapis.com/Reservation" - } - ]; - - // The maximum number of items to return per page. - int32 page_size = 2; - - // The next_page_token value returned from a previous List request, if any. - string page_token = 3; -} - -// The response for -// [ReservationService.ListReservations][google.cloud.bigquery.reservation.v1.ReservationService.ListReservations]. -message ListReservationsResponse { - // List of reservations visible to the user. - repeated Reservation reservations = 1; - - // Token to retrieve the next page of results, or empty if there are no - // more results in the list. - string next_page_token = 2; -} - -// The request for -// [ReservationService.GetReservation][google.cloud.bigquery.reservation.v1.ReservationService.GetReservation]. -message GetReservationRequest { - // Required. Resource name of the reservation to retrieve. E.g., - // `projects/myproject/locations/US/reservations/team1-prod` - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "bigqueryreservation.googleapis.com/Reservation" - } - ]; -} - -// The request for -// [ReservationService.DeleteReservation][google.cloud.bigquery.reservation.v1.ReservationService.DeleteReservation]. -message DeleteReservationRequest { - // Required. Resource name of the reservation to retrieve. E.g., - // `projects/myproject/locations/US/reservations/team1-prod` - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "bigqueryreservation.googleapis.com/Reservation" - } - ]; -} - -// The request for -// [ReservationService.UpdateReservation][google.cloud.bigquery.reservation.v1.ReservationService.UpdateReservation]. -message UpdateReservationRequest { - // Content of the reservation to update. - Reservation reservation = 1; - - // Standard field mask for the set of fields to be updated. - google.protobuf.FieldMask update_mask = 2; -} - -// The request for -// [ReservationService.CreateCapacityCommitment][google.cloud.bigquery.reservation.v1.ReservationService.CreateCapacityCommitment]. -message CreateCapacityCommitmentRequest { - // Required. Resource name of the parent reservation. E.g., - // `projects/myproject/locations/US` - string parent = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - child_type: "bigqueryreservation.googleapis.com/CapacityCommitment" - } - ]; - - // Content of the capacity commitment to create. - CapacityCommitment capacity_commitment = 2; - - // If true, fail the request if another project in the organization has a - // capacity commitment. - bool enforce_single_admin_project_per_org = 4; - - // 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 dashes. - // The first and last character cannot be a dash. Max length is 64 characters. - // NOTE: this ID won't be kept if the capacity commitment is split or merged. - string capacity_commitment_id = 5; -} - -// The request for -// [ReservationService.ListCapacityCommitments][google.cloud.bigquery.reservation.v1.ReservationService.ListCapacityCommitments]. -message ListCapacityCommitmentsRequest { - // Required. Resource name of the parent reservation. E.g., - // `projects/myproject/locations/US` - string parent = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - child_type: "bigqueryreservation.googleapis.com/CapacityCommitment" - } - ]; - - // The maximum number of items to return. - int32 page_size = 2; - - // The next_page_token value returned from a previous List request, if any. - string page_token = 3; -} - -// The response for -// [ReservationService.ListCapacityCommitments][google.cloud.bigquery.reservation.v1.ReservationService.ListCapacityCommitments]. -message ListCapacityCommitmentsResponse { - // List of capacity commitments visible to the user. - repeated CapacityCommitment capacity_commitments = 1; - - // Token to retrieve the next page of results, or empty if there are no - // more results in the list. - string next_page_token = 2; -} - -// The request for -// [ReservationService.GetCapacityCommitment][google.cloud.bigquery.reservation.v1.ReservationService.GetCapacityCommitment]. -message GetCapacityCommitmentRequest { - // Required. Resource name of the capacity commitment to retrieve. E.g., - // `projects/myproject/locations/US/capacityCommitments/123` - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "bigqueryreservation.googleapis.com/CapacityCommitment" - } - ]; -} - -// The request for -// [ReservationService.DeleteCapacityCommitment][google.cloud.bigquery.reservation.v1.ReservationService.DeleteCapacityCommitment]. -message DeleteCapacityCommitmentRequest { - // Required. Resource name of the capacity commitment to delete. E.g., - // `projects/myproject/locations/US/capacityCommitments/123` - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "bigqueryreservation.googleapis.com/CapacityCommitment" - } - ]; - - // 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. - bool force = 3; -} - -// The request for -// [ReservationService.UpdateCapacityCommitment][google.cloud.bigquery.reservation.v1.ReservationService.UpdateCapacityCommitment]. -message UpdateCapacityCommitmentRequest { - // Content of the capacity commitment to update. - CapacityCommitment capacity_commitment = 1; - - // Standard field mask for the set of fields to be updated. - google.protobuf.FieldMask update_mask = 2; -} - -// The request for -// [ReservationService.SplitCapacityCommitment][google.cloud.bigquery.reservation.v1.ReservationService.SplitCapacityCommitment]. -message SplitCapacityCommitmentRequest { - // Required. The resource name e.g.,: - // `projects/myproject/locations/US/capacityCommitments/123` - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "bigqueryreservation.googleapis.com/CapacityCommitment" - } - ]; - - // Number of slots in the capacity commitment after the split. - int64 slot_count = 2; -} - -// The response for -// [ReservationService.SplitCapacityCommitment][google.cloud.bigquery.reservation.v1.ReservationService.SplitCapacityCommitment]. -message SplitCapacityCommitmentResponse { - // First capacity commitment, result of a split. - CapacityCommitment first = 1; - - // Second capacity commitment, result of a split. - CapacityCommitment second = 2; -} - -// The request for -// [ReservationService.MergeCapacityCommitments][google.cloud.bigquery.reservation.v1.ReservationService.MergeCapacityCommitments]. -message MergeCapacityCommitmentsRequest { - // Parent resource that identifies admin project and location e.g., - // `projects/myproject/locations/us` - string parent = 1 [(google.api.resource_reference) = { - child_type: "bigqueryreservation.googleapis.com/CapacityCommitment" - }]; - - // 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 - repeated string capacity_commitment_ids = 2; -} - -// An assignment allows a project to submit jobs -// of a certain type using slots from the specified reservation. -message Assignment { - option (google.api.resource) = { - type: "bigqueryreservation.googleapis.com/Assignment" - pattern: "projects/{project}/locations/{location}/reservations/{reservation}/assignments/{assignment}" - }; - - // Types of job, which could be specified when using the reservation. - enum JobType { - // Invalid type. Requests with this value will be rejected with - // error code `google.rpc.Code.INVALID_ARGUMENT`. - JOB_TYPE_UNSPECIFIED = 0; - - // Pipeline (load/export) jobs from the project will use the reservation. - PIPELINE = 1; - - // Query jobs from the project will use the reservation. - QUERY = 2; - - // BigQuery ML jobs that use services external to BigQuery for model - // training. These jobs will not utilize idle slots from other reservations. - ML_EXTERNAL = 3; - - // Background jobs that BigQuery runs for the customers in the background. - BACKGROUND = 4; - } - - // Assignment will remain in PENDING state if no active capacity commitment is - // present. It will become ACTIVE when some capacity commitment becomes - // active. - enum State { - // Invalid state value. - STATE_UNSPECIFIED = 0; - - // Queries from assignee will be executed as on-demand, if related - // assignment is pending. - PENDING = 1; - - // Assignment is ready. - ACTIVE = 2; - } - - // Output only. Name of the resource. E.g.: - // `projects/myproject/locations/US/reservations/team1-prod/assignments/123`. - // The assignment_id must only contain lower case alphanumeric characters or - // dashes and the max length is 64 characters. - string name = 1 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // The resource which will use the reservation. E.g. - // `projects/myproject`, `folders/123`, or `organizations/456`. - string assignee = 4; - - // Which type of jobs will use the reservation. - JobType job_type = 3; - - // Output only. State of the assignment. - State state = 6 [(google.api.field_behavior) = OUTPUT_ONLY]; -} - -// The request for -// [ReservationService.CreateAssignment][google.cloud.bigquery.reservation.v1.ReservationService.CreateAssignment]. -// Note: "bigquery.reservationAssignments.create" permission is required on the -// related assignee. -message CreateAssignmentRequest { - // Required. The parent resource name of the assignment - // E.g. `projects/myproject/locations/US/reservations/team1-prod` - string parent = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - child_type: "bigqueryreservation.googleapis.com/Assignment" - } - ]; - - // Assignment resource to create. - Assignment assignment = 2; - - // 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 dashes. - // Max length is 64 characters. - string assignment_id = 4; -} - -// The request for -// [ReservationService.ListAssignments][google.cloud.bigquery.reservation.v1.ReservationService.ListAssignments]. -message ListAssignmentsRequest { - // Required. The parent resource name e.g.: - // - // `projects/myproject/locations/US/reservations/team1-prod` - // - // Or: - // - // `projects/myproject/locations/US/reservations/-` - string parent = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - child_type: "bigqueryreservation.googleapis.com/Assignment" - } - ]; - - // The maximum number of items to return per page. - int32 page_size = 2; - - // The next_page_token value returned from a previous List request, if any. - string page_token = 3; -} - -// The response for -// [ReservationService.ListAssignments][google.cloud.bigquery.reservation.v1.ReservationService.ListAssignments]. -message ListAssignmentsResponse { - // List of assignments visible to the user. - repeated Assignment assignments = 1; - - // Token to retrieve the next page of results, or empty if there are no - // more results in the list. - string next_page_token = 2; -} - -// The request for -// [ReservationService.DeleteAssignment][google.cloud.bigquery.reservation.v1.ReservationService.DeleteAssignment]. -// Note: "bigquery.reservationAssignments.delete" permission is required on the -// related assignee. -message DeleteAssignmentRequest { - // Required. Name of the resource, e.g. - // `projects/myproject/locations/US/reservations/team1-prod/assignments/123` - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "bigqueryreservation.googleapis.com/Assignment" - } - ]; -} - -// The request for -// [ReservationService.SearchAssignments][google.cloud.bigquery.reservation.v1.ReservationService.SearchAssignments]. -// Note: "bigquery.reservationAssignments.search" permission is required on the -// related assignee. -message SearchAssignmentsRequest { - // Required. The resource name of the admin project(containing project and - // location), e.g.: - // `projects/myproject/locations/US`. - string parent = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "locations.googleapis.com/Location" - } - ]; - - // Please specify resource name as assignee in the query. - // - // Examples: - // - // * `assignee=projects/myproject` - // * `assignee=folders/123` - // * `assignee=organizations/456` - string query = 2; - - // The maximum number of items to return per page. - int32 page_size = 3; - - // The next_page_token value returned from a previous List request, if any. - string page_token = 4; -} - -// The request for -// [ReservationService.SearchAllAssignments][google.cloud.bigquery.reservation.v1.ReservationService.SearchAllAssignments]. -// Note: "bigquery.reservationAssignments.search" permission is required on the -// related assignee. -message SearchAllAssignmentsRequest { - // Required. The resource name with location (project name could be the - // wildcard '-'), e.g.: - // `projects/-/locations/US`. - string parent = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "locations.googleapis.com/Location" - } - ]; - - // Please specify resource name as assignee in the query. - // - // Examples: - // - // * `assignee=projects/myproject` - // * `assignee=folders/123` - // * `assignee=organizations/456` - string query = 2; - - // The maximum number of items to return per page. - int32 page_size = 3; - - // The next_page_token value returned from a previous List request, if any. - string page_token = 4; -} - -// The response for -// [ReservationService.SearchAssignments][google.cloud.bigquery.reservation.v1.ReservationService.SearchAssignments]. -message SearchAssignmentsResponse { - // List of assignments visible to the user. - repeated Assignment assignments = 1; - - // Token to retrieve the next page of results, or empty if there are no - // more results in the list. - string next_page_token = 2; -} - -// The response for -// [ReservationService.SearchAllAssignments][google.cloud.bigquery.reservation.v1.ReservationService.SearchAllAssignments]. -message SearchAllAssignmentsResponse { - // List of assignments visible to the user. - repeated Assignment assignments = 1; - - // Token to retrieve the next page of results, or empty if there are no - // more results in the list. - string next_page_token = 2; -} - -// The request for -// [ReservationService.MoveAssignment][google.cloud.bigquery.reservation.v1.ReservationService.MoveAssignment]. -// -// **Note**: "bigquery.reservationAssignments.create" permission is required on -// the destination_id. -// -// **Note**: "bigquery.reservationAssignments.create" and -// "bigquery.reservationAssignments.delete" permission are required on the -// related assignee. -message MoveAssignmentRequest { - // Required. The resource name of the assignment, - // e.g. - // `projects/myproject/locations/US/reservations/team1-prod/assignments/123` - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "bigqueryreservation.googleapis.com/Assignment" - } - ]; - - // The new reservation ID, e.g.: - // `projects/myotherproject/locations/US/reservations/team2-prod` - string destination_id = 3 [(google.api.resource_reference) = { - child_type: "bigqueryreservation.googleapis.com/Assignment" - }]; - - // The optional assignment ID. A new assignment name is generated if this - // field is empty. - // - // This field can contain only lowercase alphanumeric characters or dashes. - // Max length is 64 characters. - string assignment_id = 5; -} - -// The request for -// [ReservationService.UpdateAssignment][google.cloud.bigquery.reservation.v1.ReservationService.UpdateAssignment]. -message UpdateAssignmentRequest { - // Content of the assignment to update. - Assignment assignment = 1; - - // Standard field mask for the set of fields to be updated. - google.protobuf.FieldMask update_mask = 2; -} - -// Fully qualified reference to BigQuery table. -// Internally stored as google.cloud.bi.v1.BqTableReference. -message TableReference { - // The assigned project ID of the project. - string project_id = 1; - - // The ID of the dataset in the above project. - string dataset_id = 2; - - // The ID of the table in the above dataset. - string table_id = 3; -} - -// Represents a BI Reservation. -message BiReservation { - option (google.api.resource) = { - type: "bigqueryreservation.googleapis.com/BiReservation" - pattern: "projects/{project}/locations/{location}/biReservation" - }; - - // The resource name of the singleton BI reservation. - // Reservation names have the form - // `projects/{project_id}/locations/{location_id}/biReservation`. - string name = 1; - - // Output only. The last update timestamp of a reservation. - google.protobuf.Timestamp update_time = 3 - [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Size of a reservation, in bytes. - int64 size = 4; - - // Preferred tables to use BI capacity for. - repeated TableReference preferred_tables = 5; -} - -// A request to get a singleton BI reservation. -message GetBiReservationRequest { - // Required. Name of the requested reservation, for example: - // `projects/{project_id}/locations/{location_id}/biReservation` - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "bigqueryreservation.googleapis.com/BiReservation" - } - ]; -} - -// A request to update a BI reservation. -message UpdateBiReservationRequest { - // A reservation to update. - BiReservation bi_reservation = 1; - - // A list of fields to be updated in this request. - google.protobuf.FieldMask update_mask = 2; -} - -// The type of editions. -// Different features and behaviors are provided to different editions -// Capacity commitments and reservations are linked to editions. -enum Edition { - // Default value, which will be treated as ENTERPRISE. - EDITION_UNSPECIFIED = 0; - - // Standard edition. - STANDARD = 1; - - // Enterprise edition. - ENTERPRISE = 2; - - // Enterprise plus edition. - ENTERPRISE_PLUS = 3; -} diff --git a/owl-bot-staging/google-cloud-bigquery-reservation/v1/samples/generated/v1/reservation_service.create_assignment.js b/owl-bot-staging/google-cloud-bigquery-reservation/v1/samples/generated/v1/reservation_service.create_assignment.js deleted file mode 100644 index 3f46c604c1e..00000000000 --- a/owl-bot-staging/google-cloud-bigquery-reservation/v1/samples/generated/v1/reservation_service.create_assignment.js +++ /dev/null @@ -1,73 +0,0 @@ -// Copyright 2023 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 -// -// https://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. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - - - -'use strict'; - -function main(parent) { - // [START bigqueryreservation_v1_generated_ReservationService_CreateAssignment_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * 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 dashes. - * 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 callCreateAssignment() { - // Construct request - const request = { - parent, - }; - - // Run request - const response = await reservationClient.createAssignment(request); - console.log(response); - } - - callCreateAssignment(); - // [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/owl-bot-staging/google-cloud-bigquery-reservation/v1/samples/generated/v1/reservation_service.create_capacity_commitment.js b/owl-bot-staging/google-cloud-bigquery-reservation/v1/samples/generated/v1/reservation_service.create_capacity_commitment.js deleted file mode 100644 index 8a6424219ed..00000000000 --- a/owl-bot-staging/google-cloud-bigquery-reservation/v1/samples/generated/v1/reservation_service.create_capacity_commitment.js +++ /dev/null @@ -1,79 +0,0 @@ -// Copyright 2023 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 -// -// https://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. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - - - -'use strict'; - -function main(parent) { - // [START bigqueryreservation_v1_generated_ReservationService_CreateCapacityCommitment_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * 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 dashes. - * The first and last character cannot be a 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 callCreateCapacityCommitment() { - // Construct request - const request = { - parent, - }; - - // Run request - const response = await reservationClient.createCapacityCommitment(request); - console.log(response); - } - - callCreateCapacityCommitment(); - // [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/owl-bot-staging/google-cloud-bigquery-reservation/v1/samples/generated/v1/reservation_service.create_reservation.js b/owl-bot-staging/google-cloud-bigquery-reservation/v1/samples/generated/v1/reservation_service.create_reservation.js deleted file mode 100644 index 53b7e9c629b..00000000000 --- a/owl-bot-staging/google-cloud-bigquery-reservation/v1/samples/generated/v1/reservation_service.create_reservation.js +++ /dev/null @@ -1,72 +0,0 @@ -// Copyright 2023 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 -// -// https://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. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - - - -'use strict'; - -function main(parent) { - // [START bigqueryreservation_v1_generated_ReservationService_CreateReservation_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. Project, location. E.g., - * `projects/myproject/locations/US` - */ - // const parent = 'abc123' - /** - * The reservation ID. It must only contain lower case alphanumeric - * characters or dashes. It must start with a letter and must not end - * with a dash. Its maximum 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 callCreateReservation() { - // Construct request - const request = { - parent, - }; - - // Run request - const response = await reservationClient.createReservation(request); - console.log(response); - } - - callCreateReservation(); - // [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/owl-bot-staging/google-cloud-bigquery-reservation/v1/samples/generated/v1/reservation_service.delete_assignment.js b/owl-bot-staging/google-cloud-bigquery-reservation/v1/samples/generated/v1/reservation_service.delete_assignment.js deleted file mode 100644 index 4b901d7f37b..00000000000 --- a/owl-bot-staging/google-cloud-bigquery-reservation/v1/samples/generated/v1/reservation_service.delete_assignment.js +++ /dev/null @@ -1,62 +0,0 @@ -// Copyright 2023 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 -// -// https://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. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - - - -'use strict'; - -function main(name) { - // [START bigqueryreservation_v1_generated_ReservationService_DeleteAssignment_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * 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 callDeleteAssignment() { - // Construct request - const request = { - name, - }; - - // Run request - const response = await reservationClient.deleteAssignment(request); - console.log(response); - } - - callDeleteAssignment(); - // [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/owl-bot-staging/google-cloud-bigquery-reservation/v1/samples/generated/v1/reservation_service.delete_capacity_commitment.js b/owl-bot-staging/google-cloud-bigquery-reservation/v1/samples/generated/v1/reservation_service.delete_capacity_commitment.js deleted file mode 100644 index e3ed916d05e..00000000000 --- a/owl-bot-staging/google-cloud-bigquery-reservation/v1/samples/generated/v1/reservation_service.delete_capacity_commitment.js +++ /dev/null @@ -1,68 +0,0 @@ -// Copyright 2023 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 -// -// https://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. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - - - -'use strict'; - -function main(name) { - // [START bigqueryreservation_v1_generated_ReservationService_DeleteCapacityCommitment_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * 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 callDeleteCapacityCommitment() { - // Construct request - const request = { - name, - }; - - // Run request - const response = await reservationClient.deleteCapacityCommitment(request); - console.log(response); - } - - callDeleteCapacityCommitment(); - // [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/owl-bot-staging/google-cloud-bigquery-reservation/v1/samples/generated/v1/reservation_service.delete_reservation.js b/owl-bot-staging/google-cloud-bigquery-reservation/v1/samples/generated/v1/reservation_service.delete_reservation.js deleted file mode 100644 index b43b3fb56b3..00000000000 --- a/owl-bot-staging/google-cloud-bigquery-reservation/v1/samples/generated/v1/reservation_service.delete_reservation.js +++ /dev/null @@ -1,62 +0,0 @@ -// Copyright 2023 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 -// -// https://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. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - - - -'use strict'; - -function main(name) { - // [START bigqueryreservation_v1_generated_ReservationService_DeleteReservation_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * 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 callDeleteReservation() { - // Construct request - const request = { - name, - }; - - // Run request - const response = await reservationClient.deleteReservation(request); - console.log(response); - } - - callDeleteReservation(); - // [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/owl-bot-staging/google-cloud-bigquery-reservation/v1/samples/generated/v1/reservation_service.get_bi_reservation.js b/owl-bot-staging/google-cloud-bigquery-reservation/v1/samples/generated/v1/reservation_service.get_bi_reservation.js deleted file mode 100644 index cd07377f8e0..00000000000 --- a/owl-bot-staging/google-cloud-bigquery-reservation/v1/samples/generated/v1/reservation_service.get_bi_reservation.js +++ /dev/null @@ -1,62 +0,0 @@ -// Copyright 2023 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 -// -// https://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. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - - - -'use strict'; - -function main(name) { - // [START bigqueryreservation_v1_generated_ReservationService_GetBiReservation_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * 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 callGetBiReservation() { - // Construct request - const request = { - name, - }; - - // Run request - const response = await reservationClient.getBiReservation(request); - console.log(response); - } - - callGetBiReservation(); - // [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/owl-bot-staging/google-cloud-bigquery-reservation/v1/samples/generated/v1/reservation_service.get_capacity_commitment.js b/owl-bot-staging/google-cloud-bigquery-reservation/v1/samples/generated/v1/reservation_service.get_capacity_commitment.js deleted file mode 100644 index 644a274ac6f..00000000000 --- a/owl-bot-staging/google-cloud-bigquery-reservation/v1/samples/generated/v1/reservation_service.get_capacity_commitment.js +++ /dev/null @@ -1,62 +0,0 @@ -// Copyright 2023 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 -// -// https://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. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - - - -'use strict'; - -function main(name) { - // [START bigqueryreservation_v1_generated_ReservationService_GetCapacityCommitment_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * 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 callGetCapacityCommitment() { - // Construct request - const request = { - name, - }; - - // Run request - const response = await reservationClient.getCapacityCommitment(request); - console.log(response); - } - - callGetCapacityCommitment(); - // [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/owl-bot-staging/google-cloud-bigquery-reservation/v1/samples/generated/v1/reservation_service.get_reservation.js b/owl-bot-staging/google-cloud-bigquery-reservation/v1/samples/generated/v1/reservation_service.get_reservation.js deleted file mode 100644 index 527b9d3e06e..00000000000 --- a/owl-bot-staging/google-cloud-bigquery-reservation/v1/samples/generated/v1/reservation_service.get_reservation.js +++ /dev/null @@ -1,62 +0,0 @@ -// Copyright 2023 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 -// -// https://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. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - - - -'use strict'; - -function main(name) { - // [START bigqueryreservation_v1_generated_ReservationService_GetReservation_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * 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 callGetReservation() { - // Construct request - const request = { - name, - }; - - // Run request - const response = await reservationClient.getReservation(request); - console.log(response); - } - - callGetReservation(); - // [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/owl-bot-staging/google-cloud-bigquery-reservation/v1/samples/generated/v1/reservation_service.list_assignments.js b/owl-bot-staging/google-cloud-bigquery-reservation/v1/samples/generated/v1/reservation_service.list_assignments.js deleted file mode 100644 index a332fe1191d..00000000000 --- a/owl-bot-staging/google-cloud-bigquery-reservation/v1/samples/generated/v1/reservation_service.list_assignments.js +++ /dev/null @@ -1,74 +0,0 @@ -// Copyright 2023 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 -// -// https://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. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - - - -'use strict'; - -function main(parent) { - // [START bigqueryreservation_v1_generated_ReservationService_ListAssignments_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * 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 callListAssignments() { - // Construct request - const request = { - parent, - }; - - // Run request - const iterable = await reservationClient.listAssignmentsAsync(request); - for await (const response of iterable) { - console.log(response); - } - } - - callListAssignments(); - // [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/owl-bot-staging/google-cloud-bigquery-reservation/v1/samples/generated/v1/reservation_service.list_capacity_commitments.js b/owl-bot-staging/google-cloud-bigquery-reservation/v1/samples/generated/v1/reservation_service.list_capacity_commitments.js deleted file mode 100644 index 5b7b802b95c..00000000000 --- a/owl-bot-staging/google-cloud-bigquery-reservation/v1/samples/generated/v1/reservation_service.list_capacity_commitments.js +++ /dev/null @@ -1,72 +0,0 @@ -// Copyright 2023 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 -// -// https://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. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - - - -'use strict'; - -function main(parent) { - // [START bigqueryreservation_v1_generated_ReservationService_ListCapacityCommitments_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * 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 callListCapacityCommitments() { - // Construct request - const request = { - parent, - }; - - // Run request - const iterable = await reservationClient.listCapacityCommitmentsAsync(request); - for await (const response of iterable) { - console.log(response); - } - } - - callListCapacityCommitments(); - // [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/owl-bot-staging/google-cloud-bigquery-reservation/v1/samples/generated/v1/reservation_service.list_reservations.js b/owl-bot-staging/google-cloud-bigquery-reservation/v1/samples/generated/v1/reservation_service.list_reservations.js deleted file mode 100644 index be6c006fdc1..00000000000 --- a/owl-bot-staging/google-cloud-bigquery-reservation/v1/samples/generated/v1/reservation_service.list_reservations.js +++ /dev/null @@ -1,72 +0,0 @@ -// Copyright 2023 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 -// -// https://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. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - - - -'use strict'; - -function main(parent) { - // [START bigqueryreservation_v1_generated_ReservationService_ListReservations_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * 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 callListReservations() { - // Construct request - const request = { - parent, - }; - - // Run request - const iterable = await reservationClient.listReservationsAsync(request); - for await (const response of iterable) { - console.log(response); - } - } - - callListReservations(); - // [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/owl-bot-staging/google-cloud-bigquery-reservation/v1/samples/generated/v1/reservation_service.merge_capacity_commitments.js b/owl-bot-staging/google-cloud-bigquery-reservation/v1/samples/generated/v1/reservation_service.merge_capacity_commitments.js deleted file mode 100644 index b3a9ae0eae3..00000000000 --- a/owl-bot-staging/google-cloud-bigquery-reservation/v1/samples/generated/v1/reservation_service.merge_capacity_commitments.js +++ /dev/null @@ -1,69 +0,0 @@ -// Copyright 2023 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 -// -// https://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. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - - - -'use strict'; - -function main() { - // [START bigqueryreservation_v1_generated_ReservationService_MergeCapacityCommitments_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * 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 callMergeCapacityCommitments() { - // Construct request - const request = { - }; - - // Run request - const response = await reservationClient.mergeCapacityCommitments(request); - console.log(response); - } - - callMergeCapacityCommitments(); - // [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/owl-bot-staging/google-cloud-bigquery-reservation/v1/samples/generated/v1/reservation_service.move_assignment.js b/owl-bot-staging/google-cloud-bigquery-reservation/v1/samples/generated/v1/reservation_service.move_assignment.js deleted file mode 100644 index e276e921492..00000000000 --- a/owl-bot-staging/google-cloud-bigquery-reservation/v1/samples/generated/v1/reservation_service.move_assignment.js +++ /dev/null @@ -1,75 +0,0 @@ -// Copyright 2023 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 -// -// https://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. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - - - -'use strict'; - -function main(name) { - // [START bigqueryreservation_v1_generated_ReservationService_MoveAssignment_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * 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' - /** - * The optional assignment ID. A new assignment name is generated if this - * field is empty. - * This field can contain only lowercase alphanumeric characters or dashes. - * 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 callMoveAssignment() { - // Construct request - const request = { - name, - }; - - // Run request - const response = await reservationClient.moveAssignment(request); - console.log(response); - } - - callMoveAssignment(); - // [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/owl-bot-staging/google-cloud-bigquery-reservation/v1/samples/generated/v1/reservation_service.search_all_assignments.js b/owl-bot-staging/google-cloud-bigquery-reservation/v1/samples/generated/v1/reservation_service.search_all_assignments.js deleted file mode 100644 index 167f612c31e..00000000000 --- a/owl-bot-staging/google-cloud-bigquery-reservation/v1/samples/generated/v1/reservation_service.search_all_assignments.js +++ /dev/null @@ -1,81 +0,0 @@ -// Copyright 2023 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 -// -// https://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. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - - - -'use strict'; - -function main(parent) { - // [START bigqueryreservation_v1_generated_ReservationService_SearchAllAssignments_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * 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 callSearchAllAssignments() { - // Construct request - const request = { - parent, - }; - - // Run request - const iterable = await reservationClient.searchAllAssignmentsAsync(request); - for await (const response of iterable) { - console.log(response); - } - } - - callSearchAllAssignments(); - // [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/owl-bot-staging/google-cloud-bigquery-reservation/v1/samples/generated/v1/reservation_service.search_assignments.js b/owl-bot-staging/google-cloud-bigquery-reservation/v1/samples/generated/v1/reservation_service.search_assignments.js deleted file mode 100644 index 69d2d047e6d..00000000000 --- a/owl-bot-staging/google-cloud-bigquery-reservation/v1/samples/generated/v1/reservation_service.search_assignments.js +++ /dev/null @@ -1,81 +0,0 @@ -// Copyright 2023 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 -// -// https://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. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - - - -'use strict'; - -function main(parent) { - // [START bigqueryreservation_v1_generated_ReservationService_SearchAssignments_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * 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 callSearchAssignments() { - // Construct request - const request = { - parent, - }; - - // Run request - const iterable = await reservationClient.searchAssignmentsAsync(request); - for await (const response of iterable) { - console.log(response); - } - } - - callSearchAssignments(); - // [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/owl-bot-staging/google-cloud-bigquery-reservation/v1/samples/generated/v1/reservation_service.split_capacity_commitment.js b/owl-bot-staging/google-cloud-bigquery-reservation/v1/samples/generated/v1/reservation_service.split_capacity_commitment.js deleted file mode 100644 index 269e4fb07ed..00000000000 --- a/owl-bot-staging/google-cloud-bigquery-reservation/v1/samples/generated/v1/reservation_service.split_capacity_commitment.js +++ /dev/null @@ -1,66 +0,0 @@ -// Copyright 2023 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 -// -// https://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. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - - - -'use strict'; - -function main(name) { - // [START bigqueryreservation_v1_generated_ReservationService_SplitCapacityCommitment_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * 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 callSplitCapacityCommitment() { - // Construct request - const request = { - name, - }; - - // Run request - const response = await reservationClient.splitCapacityCommitment(request); - console.log(response); - } - - callSplitCapacityCommitment(); - // [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/owl-bot-staging/google-cloud-bigquery-reservation/v1/samples/generated/v1/reservation_service.update_assignment.js b/owl-bot-staging/google-cloud-bigquery-reservation/v1/samples/generated/v1/reservation_service.update_assignment.js deleted file mode 100644 index 06877f99cd2..00000000000 --- a/owl-bot-staging/google-cloud-bigquery-reservation/v1/samples/generated/v1/reservation_service.update_assignment.js +++ /dev/null @@ -1,64 +0,0 @@ -// Copyright 2023 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 -// -// https://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. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - - - -'use strict'; - -function main() { - // [START bigqueryreservation_v1_generated_ReservationService_UpdateAssignment_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Content of the assignment to update. - */ - // const assignment = {} - /** - * 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 callUpdateAssignment() { - // Construct request - const request = { - }; - - // Run request - const response = await reservationClient.updateAssignment(request); - console.log(response); - } - - callUpdateAssignment(); - // [END bigqueryreservation_v1_generated_ReservationService_UpdateAssignment_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-bigquery-reservation/v1/samples/generated/v1/reservation_service.update_bi_reservation.js b/owl-bot-staging/google-cloud-bigquery-reservation/v1/samples/generated/v1/reservation_service.update_bi_reservation.js deleted file mode 100644 index 1de0e95ae13..00000000000 --- a/owl-bot-staging/google-cloud-bigquery-reservation/v1/samples/generated/v1/reservation_service.update_bi_reservation.js +++ /dev/null @@ -1,64 +0,0 @@ -// Copyright 2023 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 -// -// https://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. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - - - -'use strict'; - -function main() { - // [START bigqueryreservation_v1_generated_ReservationService_UpdateBiReservation_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * 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 callUpdateBiReservation() { - // Construct request - const request = { - }; - - // Run request - const response = await reservationClient.updateBiReservation(request); - console.log(response); - } - - callUpdateBiReservation(); - // [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/owl-bot-staging/google-cloud-bigquery-reservation/v1/samples/generated/v1/reservation_service.update_capacity_commitment.js b/owl-bot-staging/google-cloud-bigquery-reservation/v1/samples/generated/v1/reservation_service.update_capacity_commitment.js deleted file mode 100644 index acc72de49b3..00000000000 --- a/owl-bot-staging/google-cloud-bigquery-reservation/v1/samples/generated/v1/reservation_service.update_capacity_commitment.js +++ /dev/null @@ -1,64 +0,0 @@ -// Copyright 2023 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 -// -// https://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. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - - - -'use strict'; - -function main() { - // [START bigqueryreservation_v1_generated_ReservationService_UpdateCapacityCommitment_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * 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 callUpdateCapacityCommitment() { - // Construct request - const request = { - }; - - // Run request - const response = await reservationClient.updateCapacityCommitment(request); - console.log(response); - } - - callUpdateCapacityCommitment(); - // [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/owl-bot-staging/google-cloud-bigquery-reservation/v1/samples/generated/v1/reservation_service.update_reservation.js b/owl-bot-staging/google-cloud-bigquery-reservation/v1/samples/generated/v1/reservation_service.update_reservation.js deleted file mode 100644 index 189b38f67f0..00000000000 --- a/owl-bot-staging/google-cloud-bigquery-reservation/v1/samples/generated/v1/reservation_service.update_reservation.js +++ /dev/null @@ -1,64 +0,0 @@ -// Copyright 2023 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 -// -// https://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. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - - - -'use strict'; - -function main() { - // [START bigqueryreservation_v1_generated_ReservationService_UpdateReservation_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * 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 callUpdateReservation() { - // Construct request - const request = { - }; - - // Run request - const response = await reservationClient.updateReservation(request); - console.log(response); - } - - callUpdateReservation(); - // [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/owl-bot-staging/google-cloud-bigquery-reservation/v1/samples/generated/v1/snippet_metadata.google.cloud.bigquery.reservation.v1.json b/owl-bot-staging/google-cloud-bigquery-reservation/v1/samples/generated/v1/snippet_metadata.google.cloud.bigquery.reservation.v1.json deleted file mode 100644 index e1e38fbfb98..00000000000 --- a/owl-bot-staging/google-cloud-bigquery-reservation/v1/samples/generated/v1/snippet_metadata.google.cloud.bigquery.reservation.v1.json +++ /dev/null @@ -1,967 +0,0 @@ -{ - "clientLibrary": { - "name": "nodejs-reservation", - "version": "0.1.0", - "language": "TYPESCRIPT", - "apis": [ - { - "id": "google.cloud.bigquery.reservation.v1", - "version": "v1" - } - ] - }, - "snippets": [ - { - "regionTag": "bigqueryreservation_v1_generated_ReservationService_CreateReservation_async", - "title": "ReservationService createReservation Sample", - "origin": "API_DEFINITION", - "description": " Creates a new reservation resource.", - "canonical": true, - "file": "reservation_service.create_reservation.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 64, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "CreateReservation", - "fullName": "google.cloud.bigquery.reservation.v1.ReservationService.CreateReservation", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - }, - { - "name": "reservation_id", - "type": "TYPE_STRING" - }, - { - "name": "reservation", - "type": ".google.cloud.bigquery.reservation.v1.Reservation" - } - ], - "resultType": ".google.cloud.bigquery.reservation.v1.Reservation", - "client": { - "shortName": "ReservationServiceClient", - "fullName": "google.cloud.bigquery.reservation.v1.ReservationServiceClient" - }, - "method": { - "shortName": "CreateReservation", - "fullName": "google.cloud.bigquery.reservation.v1.ReservationService.CreateReservation", - "service": { - "shortName": "ReservationService", - "fullName": "google.cloud.bigquery.reservation.v1.ReservationService" - } - } - } - }, - { - "regionTag": "bigqueryreservation_v1_generated_ReservationService_ListReservations_async", - "title": "ReservationService listReservations Sample", - "origin": "API_DEFINITION", - "description": " Lists all the reservations for the project in the specified location.", - "canonical": true, - "file": "reservation_service.list_reservations.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 64, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "ListReservations", - "fullName": "google.cloud.bigquery.reservation.v1.ReservationService.ListReservations", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - }, - { - "name": "page_size", - "type": "TYPE_INT32" - }, - { - "name": "page_token", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.cloud.bigquery.reservation.v1.ListReservationsResponse", - "client": { - "shortName": "ReservationServiceClient", - "fullName": "google.cloud.bigquery.reservation.v1.ReservationServiceClient" - }, - "method": { - "shortName": "ListReservations", - "fullName": "google.cloud.bigquery.reservation.v1.ReservationService.ListReservations", - "service": { - "shortName": "ReservationService", - "fullName": "google.cloud.bigquery.reservation.v1.ReservationService" - } - } - } - }, - { - "regionTag": "bigqueryreservation_v1_generated_ReservationService_GetReservation_async", - "title": "ReservationService getReservation Sample", - "origin": "API_DEFINITION", - "description": " Returns information about the reservation.", - "canonical": true, - "file": "reservation_service.get_reservation.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 54, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "GetReservation", - "fullName": "google.cloud.bigquery.reservation.v1.ReservationService.GetReservation", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.cloud.bigquery.reservation.v1.Reservation", - "client": { - "shortName": "ReservationServiceClient", - "fullName": "google.cloud.bigquery.reservation.v1.ReservationServiceClient" - }, - "method": { - "shortName": "GetReservation", - "fullName": "google.cloud.bigquery.reservation.v1.ReservationService.GetReservation", - "service": { - "shortName": "ReservationService", - "fullName": "google.cloud.bigquery.reservation.v1.ReservationService" - } - } - } - }, - { - "regionTag": "bigqueryreservation_v1_generated_ReservationService_DeleteReservation_async", - "title": "ReservationService deleteReservation Sample", - "origin": "API_DEFINITION", - "description": " Deletes a reservation. Returns `google.rpc.Code.FAILED_PRECONDITION` when reservation has assignments.", - "canonical": true, - "file": "reservation_service.delete_reservation.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 54, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "DeleteReservation", - "fullName": "google.cloud.bigquery.reservation.v1.ReservationService.DeleteReservation", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.protobuf.Empty", - "client": { - "shortName": "ReservationServiceClient", - "fullName": "google.cloud.bigquery.reservation.v1.ReservationServiceClient" - }, - "method": { - "shortName": "DeleteReservation", - "fullName": "google.cloud.bigquery.reservation.v1.ReservationService.DeleteReservation", - "service": { - "shortName": "ReservationService", - "fullName": "google.cloud.bigquery.reservation.v1.ReservationService" - } - } - } - }, - { - "regionTag": "bigqueryreservation_v1_generated_ReservationService_UpdateReservation_async", - "title": "ReservationService updateReservation Sample", - "origin": "API_DEFINITION", - "description": " Updates an existing reservation resource.", - "canonical": true, - "file": "reservation_service.update_reservation.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 56, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "UpdateReservation", - "fullName": "google.cloud.bigquery.reservation.v1.ReservationService.UpdateReservation", - "async": true, - "parameters": [ - { - "name": "reservation", - "type": ".google.cloud.bigquery.reservation.v1.Reservation" - }, - { - "name": "update_mask", - "type": ".google.protobuf.FieldMask" - } - ], - "resultType": ".google.cloud.bigquery.reservation.v1.Reservation", - "client": { - "shortName": "ReservationServiceClient", - "fullName": "google.cloud.bigquery.reservation.v1.ReservationServiceClient" - }, - "method": { - "shortName": "UpdateReservation", - "fullName": "google.cloud.bigquery.reservation.v1.ReservationService.UpdateReservation", - "service": { - "shortName": "ReservationService", - "fullName": "google.cloud.bigquery.reservation.v1.ReservationService" - } - } - } - }, - { - "regionTag": "bigqueryreservation_v1_generated_ReservationService_CreateCapacityCommitment_async", - "title": "ReservationService createCapacityCommitment Sample", - "origin": "API_DEFINITION", - "description": " Creates a new capacity commitment resource.", - "canonical": true, - "file": "reservation_service.create_capacity_commitment.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 71, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "CreateCapacityCommitment", - "fullName": "google.cloud.bigquery.reservation.v1.ReservationService.CreateCapacityCommitment", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - }, - { - "name": "capacity_commitment", - "type": ".google.cloud.bigquery.reservation.v1.CapacityCommitment" - }, - { - "name": "enforce_single_admin_project_per_org", - "type": "TYPE_BOOL" - }, - { - "name": "capacity_commitment_id", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.cloud.bigquery.reservation.v1.CapacityCommitment", - "client": { - "shortName": "ReservationServiceClient", - "fullName": "google.cloud.bigquery.reservation.v1.ReservationServiceClient" - }, - "method": { - "shortName": "CreateCapacityCommitment", - "fullName": "google.cloud.bigquery.reservation.v1.ReservationService.CreateCapacityCommitment", - "service": { - "shortName": "ReservationService", - "fullName": "google.cloud.bigquery.reservation.v1.ReservationService" - } - } - } - }, - { - "regionTag": "bigqueryreservation_v1_generated_ReservationService_ListCapacityCommitments_async", - "title": "ReservationService listCapacityCommitments Sample", - "origin": "API_DEFINITION", - "description": " Lists all the capacity commitments for the admin project.", - "canonical": true, - "file": "reservation_service.list_capacity_commitments.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 64, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "ListCapacityCommitments", - "fullName": "google.cloud.bigquery.reservation.v1.ReservationService.ListCapacityCommitments", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - }, - { - "name": "page_size", - "type": "TYPE_INT32" - }, - { - "name": "page_token", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.cloud.bigquery.reservation.v1.ListCapacityCommitmentsResponse", - "client": { - "shortName": "ReservationServiceClient", - "fullName": "google.cloud.bigquery.reservation.v1.ReservationServiceClient" - }, - "method": { - "shortName": "ListCapacityCommitments", - "fullName": "google.cloud.bigquery.reservation.v1.ReservationService.ListCapacityCommitments", - "service": { - "shortName": "ReservationService", - "fullName": "google.cloud.bigquery.reservation.v1.ReservationService" - } - } - } - }, - { - "regionTag": "bigqueryreservation_v1_generated_ReservationService_GetCapacityCommitment_async", - "title": "ReservationService getCapacityCommitment Sample", - "origin": "API_DEFINITION", - "description": " Returns information about the capacity commitment.", - "canonical": true, - "file": "reservation_service.get_capacity_commitment.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 54, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "GetCapacityCommitment", - "fullName": "google.cloud.bigquery.reservation.v1.ReservationService.GetCapacityCommitment", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.cloud.bigquery.reservation.v1.CapacityCommitment", - "client": { - "shortName": "ReservationServiceClient", - "fullName": "google.cloud.bigquery.reservation.v1.ReservationServiceClient" - }, - "method": { - "shortName": "GetCapacityCommitment", - "fullName": "google.cloud.bigquery.reservation.v1.ReservationService.GetCapacityCommitment", - "service": { - "shortName": "ReservationService", - "fullName": "google.cloud.bigquery.reservation.v1.ReservationService" - } - } - } - }, - { - "regionTag": "bigqueryreservation_v1_generated_ReservationService_DeleteCapacityCommitment_async", - "title": "ReservationService deleteCapacityCommitment Sample", - "origin": "API_DEFINITION", - "description": " Deletes a capacity commitment. Attempting to delete capacity commitment before its commitment_end_time will fail with the error code `google.rpc.Code.FAILED_PRECONDITION`.", - "canonical": true, - "file": "reservation_service.delete_capacity_commitment.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 60, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "DeleteCapacityCommitment", - "fullName": "google.cloud.bigquery.reservation.v1.ReservationService.DeleteCapacityCommitment", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - }, - { - "name": "force", - "type": "TYPE_BOOL" - } - ], - "resultType": ".google.protobuf.Empty", - "client": { - "shortName": "ReservationServiceClient", - "fullName": "google.cloud.bigquery.reservation.v1.ReservationServiceClient" - }, - "method": { - "shortName": "DeleteCapacityCommitment", - "fullName": "google.cloud.bigquery.reservation.v1.ReservationService.DeleteCapacityCommitment", - "service": { - "shortName": "ReservationService", - "fullName": "google.cloud.bigquery.reservation.v1.ReservationService" - } - } - } - }, - { - "regionTag": "bigqueryreservation_v1_generated_ReservationService_UpdateCapacityCommitment_async", - "title": "ReservationService updateCapacityCommitment Sample", - "origin": "API_DEFINITION", - "description": " Updates an existing capacity commitment. Only `plan` and `renewal_plan` fields can be updated. Plan can only be changed to a plan of a longer commitment period. Attempting to change to a plan with shorter commitment period will fail with the error code `google.rpc.Code.FAILED_PRECONDITION`.", - "canonical": true, - "file": "reservation_service.update_capacity_commitment.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 56, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "UpdateCapacityCommitment", - "fullName": "google.cloud.bigquery.reservation.v1.ReservationService.UpdateCapacityCommitment", - "async": true, - "parameters": [ - { - "name": "capacity_commitment", - "type": ".google.cloud.bigquery.reservation.v1.CapacityCommitment" - }, - { - "name": "update_mask", - "type": ".google.protobuf.FieldMask" - } - ], - "resultType": ".google.cloud.bigquery.reservation.v1.CapacityCommitment", - "client": { - "shortName": "ReservationServiceClient", - "fullName": "google.cloud.bigquery.reservation.v1.ReservationServiceClient" - }, - "method": { - "shortName": "UpdateCapacityCommitment", - "fullName": "google.cloud.bigquery.reservation.v1.ReservationService.UpdateCapacityCommitment", - "service": { - "shortName": "ReservationService", - "fullName": "google.cloud.bigquery.reservation.v1.ReservationService" - } - } - } - }, - { - "regionTag": "bigqueryreservation_v1_generated_ReservationService_SplitCapacityCommitment_async", - "title": "ReservationService splitCapacityCommitment Sample", - "origin": "API_DEFINITION", - "description": " Splits capacity commitment to two commitments of the same plan and `commitment_end_time`. A common use case is to enable downgrading commitments. For example, in order to downgrade from 10000 slots to 8000, you might split a 10000 capacity commitment into commitments of 2000 and 8000. Then, you delete the first one after the commitment end time passes.", - "canonical": true, - "file": "reservation_service.split_capacity_commitment.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 58, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "SplitCapacityCommitment", - "fullName": "google.cloud.bigquery.reservation.v1.ReservationService.SplitCapacityCommitment", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - }, - { - "name": "slot_count", - "type": "TYPE_INT64" - } - ], - "resultType": ".google.cloud.bigquery.reservation.v1.SplitCapacityCommitmentResponse", - "client": { - "shortName": "ReservationServiceClient", - "fullName": "google.cloud.bigquery.reservation.v1.ReservationServiceClient" - }, - "method": { - "shortName": "SplitCapacityCommitment", - "fullName": "google.cloud.bigquery.reservation.v1.ReservationService.SplitCapacityCommitment", - "service": { - "shortName": "ReservationService", - "fullName": "google.cloud.bigquery.reservation.v1.ReservationService" - } - } - } - }, - { - "regionTag": "bigqueryreservation_v1_generated_ReservationService_MergeCapacityCommitments_async", - "title": "ReservationService mergeCapacityCommitments Sample", - "origin": "API_DEFINITION", - "description": " Merges capacity commitments of the same plan into a single commitment. The resulting capacity commitment has the greater commitment_end_time out of the to-be-merged capacity commitments. Attempting to merge capacity commitments of different plan will fail with the error code `google.rpc.Code.FAILED_PRECONDITION`.", - "canonical": true, - "file": "reservation_service.merge_capacity_commitments.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 61, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "MergeCapacityCommitments", - "fullName": "google.cloud.bigquery.reservation.v1.ReservationService.MergeCapacityCommitments", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - }, - { - "name": "capacity_commitment_ids", - "type": "TYPE_STRING[]" - } - ], - "resultType": ".google.cloud.bigquery.reservation.v1.CapacityCommitment", - "client": { - "shortName": "ReservationServiceClient", - "fullName": "google.cloud.bigquery.reservation.v1.ReservationServiceClient" - }, - "method": { - "shortName": "MergeCapacityCommitments", - "fullName": "google.cloud.bigquery.reservation.v1.ReservationService.MergeCapacityCommitments", - "service": { - "shortName": "ReservationService", - "fullName": "google.cloud.bigquery.reservation.v1.ReservationService" - } - } - } - }, - { - "regionTag": "bigqueryreservation_v1_generated_ReservationService_CreateAssignment_async", - "title": "ReservationService createAssignment Sample", - "origin": "API_DEFINITION", - "description": " Creates an assignment object which allows the given project to submit jobs of a certain type using slots from the specified reservation. Currently a resource (project, folder, organization) can only have one assignment per each (job_type, location) combination, and that reservation will be used for all jobs of the matching type. Different assignments can be created on different levels of the projects, folders or organization hierarchy. During query execution, the assignment is looked up at the project, folder and organization levels in that order. The first assignment found is applied to the query. When creating assignments, it does not matter if other assignments exist at higher levels. Example: * The organization `organizationA` contains two projects, `project1` and `project2`. * Assignments for all three entities (`organizationA`, `project1`, and `project2`) could all be created and mapped to the same or different reservations. \"None\" assignments represent an absence of the assignment. Projects assigned to None use on-demand pricing. To create a \"None\" assignment, use \"none\" as a reservation_id in the parent. Example parent: `projects/myproject/locations/US/reservations/none`. Returns `google.rpc.Code.PERMISSION_DENIED` if user does not have 'bigquery.admin' permissions on the project using the reservation and the project that owns this reservation. Returns `google.rpc.Code.INVALID_ARGUMENT` when location of the assignment does not match location of the reservation.", - "canonical": true, - "file": "reservation_service.create_assignment.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 65, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "CreateAssignment", - "fullName": "google.cloud.bigquery.reservation.v1.ReservationService.CreateAssignment", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - }, - { - "name": "assignment", - "type": ".google.cloud.bigquery.reservation.v1.Assignment" - }, - { - "name": "assignment_id", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.cloud.bigquery.reservation.v1.Assignment", - "client": { - "shortName": "ReservationServiceClient", - "fullName": "google.cloud.bigquery.reservation.v1.ReservationServiceClient" - }, - "method": { - "shortName": "CreateAssignment", - "fullName": "google.cloud.bigquery.reservation.v1.ReservationService.CreateAssignment", - "service": { - "shortName": "ReservationService", - "fullName": "google.cloud.bigquery.reservation.v1.ReservationService" - } - } - } - }, - { - "regionTag": "bigqueryreservation_v1_generated_ReservationService_ListAssignments_async", - "title": "ReservationService listAssignments Sample", - "origin": "API_DEFINITION", - "description": " Lists assignments. Only explicitly created assignments will be returned. Example: * Organization `organizationA` contains two projects, `project1` and `project2`. * Reservation `res1` exists and was created previously. * CreateAssignment was used previously to define the following associations between entities and reservations: `` and `` In this example, ListAssignments will just return the above two assignments for reservation `res1`, and no expansion/merge will happen. The wildcard \"-\" can be used for reservations in the request. In that case all assignments belongs to the specified project and location will be listed. **Note** \"-\" cannot be used for projects nor locations.", - "canonical": true, - "file": "reservation_service.list_assignments.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 66, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "ListAssignments", - "fullName": "google.cloud.bigquery.reservation.v1.ReservationService.ListAssignments", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - }, - { - "name": "page_size", - "type": "TYPE_INT32" - }, - { - "name": "page_token", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.cloud.bigquery.reservation.v1.ListAssignmentsResponse", - "client": { - "shortName": "ReservationServiceClient", - "fullName": "google.cloud.bigquery.reservation.v1.ReservationServiceClient" - }, - "method": { - "shortName": "ListAssignments", - "fullName": "google.cloud.bigquery.reservation.v1.ReservationService.ListAssignments", - "service": { - "shortName": "ReservationService", - "fullName": "google.cloud.bigquery.reservation.v1.ReservationService" - } - } - } - }, - { - "regionTag": "bigqueryreservation_v1_generated_ReservationService_DeleteAssignment_async", - "title": "ReservationService deleteAssignment Sample", - "origin": "API_DEFINITION", - "description": " Deletes a assignment. No expansion will happen. Example: * Organization `organizationA` contains two projects, `project1` and `project2`. * Reservation `res1` exists and was created previously. * CreateAssignment was used previously to define the following associations between entities and reservations: `` and `` In this example, deletion of the `` assignment won't affect the other assignment ``. After said deletion, queries from `project1` will still use `res1` while queries from `project2` will switch to use on-demand mode.", - "canonical": true, - "file": "reservation_service.delete_assignment.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 54, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "DeleteAssignment", - "fullName": "google.cloud.bigquery.reservation.v1.ReservationService.DeleteAssignment", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.protobuf.Empty", - "client": { - "shortName": "ReservationServiceClient", - "fullName": "google.cloud.bigquery.reservation.v1.ReservationServiceClient" - }, - "method": { - "shortName": "DeleteAssignment", - "fullName": "google.cloud.bigquery.reservation.v1.ReservationService.DeleteAssignment", - "service": { - "shortName": "ReservationService", - "fullName": "google.cloud.bigquery.reservation.v1.ReservationService" - } - } - } - }, - { - "regionTag": "bigqueryreservation_v1_generated_ReservationService_SearchAssignments_async", - "title": "ReservationService searchAssignments Sample", - "origin": "API_DEFINITION", - "description": " Deprecated: Looks up assignments for a specified resource for a particular region. If the request is about a project: 1. Assignments created on the project will be returned if they exist. 2. Otherwise assignments created on the closest ancestor will be returned. 3. Assignments for different JobTypes will all be returned. The same logic applies if the request is about a folder. If the request is about an organization, then assignments created on the organization will be returned (organization doesn't have ancestors). Comparing to ListAssignments, there are some behavior differences: 1. permission on the assignee will be verified in this API. 2. Hierarchy lookup (project->folder->organization) happens in this API. 3. Parent here is `projects/*/locations/*`, instead of `projects/*/locations/*reservations/*`. **Note** \"-\" cannot be used for projects nor locations.", - "canonical": true, - "file": "reservation_service.search_assignments.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 73, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "SearchAssignments", - "fullName": "google.cloud.bigquery.reservation.v1.ReservationService.SearchAssignments", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - }, - { - "name": "query", - "type": "TYPE_STRING" - }, - { - "name": "page_size", - "type": "TYPE_INT32" - }, - { - "name": "page_token", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.cloud.bigquery.reservation.v1.SearchAssignmentsResponse", - "client": { - "shortName": "ReservationServiceClient", - "fullName": "google.cloud.bigquery.reservation.v1.ReservationServiceClient" - }, - "method": { - "shortName": "SearchAssignments", - "fullName": "google.cloud.bigquery.reservation.v1.ReservationService.SearchAssignments", - "service": { - "shortName": "ReservationService", - "fullName": "google.cloud.bigquery.reservation.v1.ReservationService" - } - } - } - }, - { - "regionTag": "bigqueryreservation_v1_generated_ReservationService_SearchAllAssignments_async", - "title": "ReservationService searchAllAssignments Sample", - "origin": "API_DEFINITION", - "description": " Looks up assignments for a specified resource for a particular region. If the request is about a project: 1. Assignments created on the project will be returned if they exist. 2. Otherwise assignments created on the closest ancestor will be returned. 3. Assignments for different JobTypes will all be returned. The same logic applies if the request is about a folder. If the request is about an organization, then assignments created on the organization will be returned (organization doesn't have ancestors). Comparing to ListAssignments, there are some behavior differences: 1. permission on the assignee will be verified in this API. 2. Hierarchy lookup (project->folder->organization) happens in this API. 3. Parent here is `projects/*/locations/*`, instead of `projects/*/locations/*reservations/*`.", - "canonical": true, - "file": "reservation_service.search_all_assignments.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 73, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "SearchAllAssignments", - "fullName": "google.cloud.bigquery.reservation.v1.ReservationService.SearchAllAssignments", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - }, - { - "name": "query", - "type": "TYPE_STRING" - }, - { - "name": "page_size", - "type": "TYPE_INT32" - }, - { - "name": "page_token", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.cloud.bigquery.reservation.v1.SearchAllAssignmentsResponse", - "client": { - "shortName": "ReservationServiceClient", - "fullName": "google.cloud.bigquery.reservation.v1.ReservationServiceClient" - }, - "method": { - "shortName": "SearchAllAssignments", - "fullName": "google.cloud.bigquery.reservation.v1.ReservationService.SearchAllAssignments", - "service": { - "shortName": "ReservationService", - "fullName": "google.cloud.bigquery.reservation.v1.ReservationService" - } - } - } - }, - { - "regionTag": "bigqueryreservation_v1_generated_ReservationService_MoveAssignment_async", - "title": "ReservationService moveAssignment Sample", - "origin": "API_DEFINITION", - "description": " Moves an assignment under a new reservation. This differs from removing an existing assignment and recreating a new one by providing a transactional change that ensures an assignee always has an associated reservation.", - "canonical": true, - "file": "reservation_service.move_assignment.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 67, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "MoveAssignment", - "fullName": "google.cloud.bigquery.reservation.v1.ReservationService.MoveAssignment", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - }, - { - "name": "destination_id", - "type": "TYPE_STRING" - }, - { - "name": "assignment_id", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.cloud.bigquery.reservation.v1.Assignment", - "client": { - "shortName": "ReservationServiceClient", - "fullName": "google.cloud.bigquery.reservation.v1.ReservationServiceClient" - }, - "method": { - "shortName": "MoveAssignment", - "fullName": "google.cloud.bigquery.reservation.v1.ReservationService.MoveAssignment", - "service": { - "shortName": "ReservationService", - "fullName": "google.cloud.bigquery.reservation.v1.ReservationService" - } - } - } - }, - { - "regionTag": "bigqueryreservation_v1_generated_ReservationService_UpdateAssignment_async", - "title": "ReservationService updateAssignment Sample", - "origin": "API_DEFINITION", - "description": " Updates an existing assignment. Only the `priority` field can be updated.", - "canonical": true, - "file": "reservation_service.update_assignment.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 56, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "UpdateAssignment", - "fullName": "google.cloud.bigquery.reservation.v1.ReservationService.UpdateAssignment", - "async": true, - "parameters": [ - { - "name": "assignment", - "type": ".google.cloud.bigquery.reservation.v1.Assignment" - }, - { - "name": "update_mask", - "type": ".google.protobuf.FieldMask" - } - ], - "resultType": ".google.cloud.bigquery.reservation.v1.Assignment", - "client": { - "shortName": "ReservationServiceClient", - "fullName": "google.cloud.bigquery.reservation.v1.ReservationServiceClient" - }, - "method": { - "shortName": "UpdateAssignment", - "fullName": "google.cloud.bigquery.reservation.v1.ReservationService.UpdateAssignment", - "service": { - "shortName": "ReservationService", - "fullName": "google.cloud.bigquery.reservation.v1.ReservationService" - } - } - } - }, - { - "regionTag": "bigqueryreservation_v1_generated_ReservationService_GetBiReservation_async", - "title": "ReservationService getBiReservation Sample", - "origin": "API_DEFINITION", - "description": " Retrieves a BI reservation.", - "canonical": true, - "file": "reservation_service.get_bi_reservation.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 54, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "GetBiReservation", - "fullName": "google.cloud.bigquery.reservation.v1.ReservationService.GetBiReservation", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.cloud.bigquery.reservation.v1.BiReservation", - "client": { - "shortName": "ReservationServiceClient", - "fullName": "google.cloud.bigquery.reservation.v1.ReservationServiceClient" - }, - "method": { - "shortName": "GetBiReservation", - "fullName": "google.cloud.bigquery.reservation.v1.ReservationService.GetBiReservation", - "service": { - "shortName": "ReservationService", - "fullName": "google.cloud.bigquery.reservation.v1.ReservationService" - } - } - } - }, - { - "regionTag": "bigqueryreservation_v1_generated_ReservationService_UpdateBiReservation_async", - "title": "ReservationService updateBiReservation Sample", - "origin": "API_DEFINITION", - "description": " Updates a BI reservation. Only fields specified in the `field_mask` are updated. A singleton BI reservation always exists with default size 0. In order to reserve BI capacity it needs to be updated to an amount greater than 0. In order to release BI capacity reservation size must be set to 0.", - "canonical": true, - "file": "reservation_service.update_bi_reservation.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 56, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "UpdateBiReservation", - "fullName": "google.cloud.bigquery.reservation.v1.ReservationService.UpdateBiReservation", - "async": true, - "parameters": [ - { - "name": "bi_reservation", - "type": ".google.cloud.bigquery.reservation.v1.BiReservation" - }, - { - "name": "update_mask", - "type": ".google.protobuf.FieldMask" - } - ], - "resultType": ".google.cloud.bigquery.reservation.v1.BiReservation", - "client": { - "shortName": "ReservationServiceClient", - "fullName": "google.cloud.bigquery.reservation.v1.ReservationServiceClient" - }, - "method": { - "shortName": "UpdateBiReservation", - "fullName": "google.cloud.bigquery.reservation.v1.ReservationService.UpdateBiReservation", - "service": { - "shortName": "ReservationService", - "fullName": "google.cloud.bigquery.reservation.v1.ReservationService" - } - } - } - } - ] -} diff --git a/owl-bot-staging/google-cloud-bigquery-reservation/v1/src/index.ts b/owl-bot-staging/google-cloud-bigquery-reservation/v1/src/index.ts deleted file mode 100644 index 0f2e9cd8dd4..00000000000 --- a/owl-bot-staging/google-cloud-bigquery-reservation/v1/src/index.ts +++ /dev/null @@ -1,25 +0,0 @@ -// Copyright 2023 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 -// -// https://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. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - -import * as v1 from './v1'; -const ReservationServiceClient = v1.ReservationServiceClient; -type ReservationServiceClient = v1.ReservationServiceClient; -export {v1, ReservationServiceClient}; -export default {v1, ReservationServiceClient}; -import * as protos from '../protos/protos'; -export {protos} diff --git a/owl-bot-staging/google-cloud-bigquery-reservation/v1/src/v1/gapic_metadata.json b/owl-bot-staging/google-cloud-bigquery-reservation/v1/src/v1/gapic_metadata.json deleted file mode 100644 index 03838a39d9b..00000000000 --- a/owl-bot-staging/google-cloud-bigquery-reservation/v1/src/v1/gapic_metadata.json +++ /dev/null @@ -1,253 +0,0 @@ -{ - "schema": "1.0", - "comment": "This file maps proto services/RPCs to the corresponding library clients/methods", - "language": "typescript", - "protoPackage": "google.cloud.bigquery.reservation.v1", - "libraryPackage": "@google-cloud/bigquery-reservation", - "services": { - "ReservationService": { - "clients": { - "grpc": { - "libraryClient": "ReservationServiceClient", - "rpcs": { - "CreateReservation": { - "methods": [ - "createReservation" - ] - }, - "GetReservation": { - "methods": [ - "getReservation" - ] - }, - "DeleteReservation": { - "methods": [ - "deleteReservation" - ] - }, - "UpdateReservation": { - "methods": [ - "updateReservation" - ] - }, - "CreateCapacityCommitment": { - "methods": [ - "createCapacityCommitment" - ] - }, - "GetCapacityCommitment": { - "methods": [ - "getCapacityCommitment" - ] - }, - "DeleteCapacityCommitment": { - "methods": [ - "deleteCapacityCommitment" - ] - }, - "UpdateCapacityCommitment": { - "methods": [ - "updateCapacityCommitment" - ] - }, - "SplitCapacityCommitment": { - "methods": [ - "splitCapacityCommitment" - ] - }, - "MergeCapacityCommitments": { - "methods": [ - "mergeCapacityCommitments" - ] - }, - "CreateAssignment": { - "methods": [ - "createAssignment" - ] - }, - "DeleteAssignment": { - "methods": [ - "deleteAssignment" - ] - }, - "MoveAssignment": { - "methods": [ - "moveAssignment" - ] - }, - "UpdateAssignment": { - "methods": [ - "updateAssignment" - ] - }, - "GetBiReservation": { - "methods": [ - "getBiReservation" - ] - }, - "UpdateBiReservation": { - "methods": [ - "updateBiReservation" - ] - }, - "ListReservations": { - "methods": [ - "listReservations", - "listReservationsStream", - "listReservationsAsync" - ] - }, - "ListCapacityCommitments": { - "methods": [ - "listCapacityCommitments", - "listCapacityCommitmentsStream", - "listCapacityCommitmentsAsync" - ] - }, - "ListAssignments": { - "methods": [ - "listAssignments", - "listAssignmentsStream", - "listAssignmentsAsync" - ] - }, - "SearchAssignments": { - "methods": [ - "searchAssignments", - "searchAssignmentsStream", - "searchAssignmentsAsync" - ] - }, - "SearchAllAssignments": { - "methods": [ - "searchAllAssignments", - "searchAllAssignmentsStream", - "searchAllAssignmentsAsync" - ] - } - } - }, - "grpc-fallback": { - "libraryClient": "ReservationServiceClient", - "rpcs": { - "CreateReservation": { - "methods": [ - "createReservation" - ] - }, - "GetReservation": { - "methods": [ - "getReservation" - ] - }, - "DeleteReservation": { - "methods": [ - "deleteReservation" - ] - }, - "UpdateReservation": { - "methods": [ - "updateReservation" - ] - }, - "CreateCapacityCommitment": { - "methods": [ - "createCapacityCommitment" - ] - }, - "GetCapacityCommitment": { - "methods": [ - "getCapacityCommitment" - ] - }, - "DeleteCapacityCommitment": { - "methods": [ - "deleteCapacityCommitment" - ] - }, - "UpdateCapacityCommitment": { - "methods": [ - "updateCapacityCommitment" - ] - }, - "SplitCapacityCommitment": { - "methods": [ - "splitCapacityCommitment" - ] - }, - "MergeCapacityCommitments": { - "methods": [ - "mergeCapacityCommitments" - ] - }, - "CreateAssignment": { - "methods": [ - "createAssignment" - ] - }, - "DeleteAssignment": { - "methods": [ - "deleteAssignment" - ] - }, - "MoveAssignment": { - "methods": [ - "moveAssignment" - ] - }, - "UpdateAssignment": { - "methods": [ - "updateAssignment" - ] - }, - "GetBiReservation": { - "methods": [ - "getBiReservation" - ] - }, - "UpdateBiReservation": { - "methods": [ - "updateBiReservation" - ] - }, - "ListReservations": { - "methods": [ - "listReservations", - "listReservationsStream", - "listReservationsAsync" - ] - }, - "ListCapacityCommitments": { - "methods": [ - "listCapacityCommitments", - "listCapacityCommitmentsStream", - "listCapacityCommitmentsAsync" - ] - }, - "ListAssignments": { - "methods": [ - "listAssignments", - "listAssignmentsStream", - "listAssignmentsAsync" - ] - }, - "SearchAssignments": { - "methods": [ - "searchAssignments", - "searchAssignmentsStream", - "searchAssignmentsAsync" - ] - }, - "SearchAllAssignments": { - "methods": [ - "searchAllAssignments", - "searchAllAssignmentsStream", - "searchAllAssignmentsAsync" - ] - } - } - } - } - } - } -} diff --git a/owl-bot-staging/google-cloud-bigquery-reservation/v1/src/v1/index.ts b/owl-bot-staging/google-cloud-bigquery-reservation/v1/src/v1/index.ts deleted file mode 100644 index c9be59e652f..00000000000 --- a/owl-bot-staging/google-cloud-bigquery-reservation/v1/src/v1/index.ts +++ /dev/null @@ -1,19 +0,0 @@ -// Copyright 2023 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 -// -// https://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. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - -export {ReservationServiceClient} from './reservation_service_client'; diff --git a/owl-bot-staging/google-cloud-bigquery-reservation/v1/src/v1/reservation_service_client.ts b/owl-bot-staging/google-cloud-bigquery-reservation/v1/src/v1/reservation_service_client.ts deleted file mode 100644 index 13af8d73b8c..00000000000 --- a/owl-bot-staging/google-cloud-bigquery-reservation/v1/src/v1/reservation_service_client.ts +++ /dev/null @@ -1,2924 +0,0 @@ -// Copyright 2023 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 -// -// https://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. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - -/* global window */ -import type * as gax from 'google-gax'; -import type {Callback, CallOptions, Descriptors, ClientOptions, PaginationCallback, GaxCall} from 'google-gax'; -import {Transform} from 'stream'; -import * as protos from '../../protos/protos'; -import jsonProtos = require('../../protos/protos.json'); -/** - * Client JSON configuration object, loaded from - * `src/v1/reservation_service_client_config.json`. - * This file defines retry strategy and timeouts for all API methods in this library. - */ -import * as gapicConfig from './reservation_service_client_config.json'; -const version = require('../../../package.json').version; - -/** - * This API allows users to manage their flat-rate BigQuery reservations. - * - * A reservation provides computational resource guarantees, in the form of - * [slots](https://cloud.google.com/bigquery/docs/slots), to users. A slot is a - * unit of computational power in BigQuery, and serves as the basic unit of - * parallelism. In a scan of a multi-partitioned table, a single slot operates - * on a single partition of the table. A reservation resource exists as a child - * resource of the admin project and location, e.g.: - * `projects/myproject/locations/US/reservations/reservationName`. - * - * A capacity commitment is a way to purchase compute capacity for BigQuery jobs - * (in the form of slots) with some committed period of usage. A capacity - * commitment resource exists as a child resource of the admin project and - * location, e.g.: - * `projects/myproject/locations/US/capacityCommitments/id`. - * @class - * @memberof v1 - */ -export class ReservationServiceClient { - private _terminated = false; - private _opts: ClientOptions; - private _providedCustomServicePath: boolean; - private _gaxModule: typeof gax | typeof gax.fallback; - private _gaxGrpc: gax.GrpcClient | gax.fallback.GrpcClient; - private _protos: {}; - private _defaults: {[method: string]: gax.CallSettings}; - auth: gax.GoogleAuth; - descriptors: Descriptors = { - page: {}, - stream: {}, - longrunning: {}, - batching: {}, - }; - warn: (code: string, message: string, warnType?: string) => void; - innerApiCalls: {[name: string]: Function}; - pathTemplates: {[name: string]: gax.PathTemplate}; - reservationServiceStub?: Promise<{[name: string]: Function}>; - - /** - * Construct an instance of ReservationServiceClient. - * - * @param {object} [options] - The configuration object. - * The options accepted by the constructor are described in detail - * in [this document](https://github.com/googleapis/gax-nodejs/blob/main/client-libraries.md#creating-the-client-instance). - * The common options are: - * @param {object} [options.credentials] - Credentials object. - * @param {string} [options.credentials.client_email] - * @param {string} [options.credentials.private_key] - * @param {string} [options.email] - Account email address. Required when - * using a .pem or .p12 keyFilename. - * @param {string} [options.keyFilename] - Full path to the a .json, .pem, or - * .p12 key downloaded from the Google Developers Console. If you provide - * a path to a JSON file, the projectId option below is not necessary. - * NOTE: .pem and .p12 require you to specify options.email as well. - * @param {number} [options.port] - The port on which to connect to - * the remote host. - * @param {string} [options.projectId] - The project ID from the Google - * Developer's Console, e.g. 'grape-spaceship-123'. We will also check - * the environment variable GCLOUD_PROJECT for your project ID. If your - * app is running in an environment which supports - * {@link https://developers.google.com/identity/protocols/application-default-credentials Application Default Credentials}, - * your project ID will be detected automatically. - * @param {string} [options.apiEndpoint] - The domain name of the - * API remote host. - * @param {gax.ClientConfig} [options.clientConfig] - Client configuration override. - * Follows the structure of {@link gapicConfig}. - * @param {boolean | "rest"} [options.fallback] - Use HTTP fallback mode. - * Pass "rest" to use HTTP/1.1 REST API instead of gRPC. - * For more information, please check the - * {@link https://github.com/googleapis/gax-nodejs/blob/main/client-libraries.md#http11-rest-api-mode documentation}. - * @param {gax} [gaxInstance]: loaded instance of `google-gax`. Useful if you - * need to avoid loading the default gRPC version and want to use the fallback - * HTTP implementation. Load only fallback version and pass it to the constructor: - * ``` - * const gax = require('google-gax/build/src/fallback'); // avoids loading google-gax with gRPC - * const client = new ReservationServiceClient({fallback: 'rest'}, gax); - * ``` - */ - constructor(opts?: ClientOptions, gaxInstance?: typeof gax | typeof gax.fallback) { - // Ensure that options include all the required fields. - const staticMembers = this.constructor as typeof ReservationServiceClient; - const servicePath = opts?.servicePath || opts?.apiEndpoint || staticMembers.servicePath; - this._providedCustomServicePath = !!(opts?.servicePath || opts?.apiEndpoint); - const port = opts?.port || staticMembers.port; - const clientConfig = opts?.clientConfig ?? {}; - const fallback = opts?.fallback ?? (typeof window !== 'undefined' && typeof window?.fetch === 'function'); - opts = Object.assign({servicePath, port, clientConfig, fallback}, opts); - - // Request numeric enum values if REST transport is used. - opts.numericEnums = true; - - // If scopes are unset in options and we're connecting to a non-default endpoint, set scopes just in case. - if (servicePath !== staticMembers.servicePath && !('scopes' in opts)) { - opts['scopes'] = staticMembers.scopes; - } - - // Load google-gax module synchronously if needed - if (!gaxInstance) { - gaxInstance = require('google-gax') as typeof gax; - } - - // Choose either gRPC or proto-over-HTTP implementation of google-gax. - this._gaxModule = opts.fallback ? gaxInstance.fallback : gaxInstance; - - // Create a `gaxGrpc` object, with any grpc-specific options sent to the client. - this._gaxGrpc = new this._gaxModule.GrpcClient(opts); - - // Save options to use in initialize() method. - this._opts = opts; - - // Save the auth object to the client, for use by other methods. - this.auth = (this._gaxGrpc.auth as gax.GoogleAuth); - - // Set useJWTAccessWithScope on the auth object. - this.auth.useJWTAccessWithScope = true; - - // Set defaultServicePath on the auth object. - this.auth.defaultServicePath = staticMembers.servicePath; - - // Set the default scopes in auth client if needed. - if (servicePath === staticMembers.servicePath) { - this.auth.defaultScopes = staticMembers.scopes; - } - - // Determine the client header string. - const clientHeader = [ - `gax/${this._gaxModule.version}`, - `gapic/${version}`, - ]; - if (typeof process !== 'undefined' && 'versions' in process) { - clientHeader.push(`gl-node/${process.versions.node}`); - } else { - clientHeader.push(`gl-web/${this._gaxModule.version}`); - } - if (!opts.fallback) { - clientHeader.push(`grpc/${this._gaxGrpc.grpcVersion}`); - } else if (opts.fallback === 'rest' ) { - clientHeader.push(`rest/${this._gaxGrpc.grpcVersion}`); - } - if (opts.libName && opts.libVersion) { - clientHeader.push(`${opts.libName}/${opts.libVersion}`); - } - // Load the applicable protos. - this._protos = this._gaxGrpc.loadProtoJSON(jsonProtos); - - // This API contains "path templates"; forward-slash-separated - // identifiers to uniquely identify resources within the API. - // Create useful helper objects for these. - this.pathTemplates = { - assignmentPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/reservations/{reservation}/assignments/{assignment}' - ), - biReservationPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/biReservation' - ), - capacityCommitmentPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/capacityCommitments/{capacity_commitment}' - ), - locationPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}' - ), - projectPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}' - ), - reservationPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/reservations/{reservation}' - ), - }; - - // Some of the methods on this service return "paged" results, - // (e.g. 50 results at a time, with tokens to get subsequent - // pages). Denote the keys used for pagination and results. - this.descriptors.page = { - listReservations: - new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'reservations'), - listCapacityCommitments: - new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'capacityCommitments'), - listAssignments: - new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'assignments'), - searchAssignments: - new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'assignments'), - searchAllAssignments: - new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'assignments') - }; - - // Put together the default options sent with requests. - this._defaults = this._gaxGrpc.constructSettings( - 'google.cloud.bigquery.reservation.v1.ReservationService', gapicConfig as gax.ClientConfig, - opts.clientConfig || {}, {'x-goog-api-client': clientHeader.join(' ')}); - - // Set up a dictionary of "inner API calls"; the core implementation - // of calling the API is handled in `google-gax`, with this code - // merely providing the destination and request information. - this.innerApiCalls = {}; - - // Add a warn function to the client constructor so it can be easily tested. - this.warn = this._gaxModule.warn; - } - - /** - * Initialize the client. - * Performs asynchronous operations (such as authentication) and prepares the client. - * This function will be called automatically when any class method is called for the - * first time, but if you need to initialize it before calling an actual method, - * feel free to call initialize() directly. - * - * You can await on this method if you want to make sure the client is initialized. - * - * @returns {Promise} A promise that resolves to an authenticated service stub. - */ - initialize() { - // If the client stub promise is already initialized, return immediately. - if (this.reservationServiceStub) { - return this.reservationServiceStub; - } - - // Put together the "service stub" for - // google.cloud.bigquery.reservation.v1.ReservationService. - this.reservationServiceStub = this._gaxGrpc.createStub( - this._opts.fallback ? - (this._protos as protobuf.Root).lookupService('google.cloud.bigquery.reservation.v1.ReservationService') : - // eslint-disable-next-line @typescript-eslint/no-explicit-any - (this._protos as any).google.cloud.bigquery.reservation.v1.ReservationService, - this._opts, this._providedCustomServicePath) as Promise<{[method: string]: Function}>; - - // Iterate over each of the methods that the service provides - // and create an API call method for each. - const reservationServiceStubMethods = - ['createReservation', 'listReservations', 'getReservation', 'deleteReservation', 'updateReservation', 'createCapacityCommitment', 'listCapacityCommitments', 'getCapacityCommitment', 'deleteCapacityCommitment', 'updateCapacityCommitment', 'splitCapacityCommitment', 'mergeCapacityCommitments', 'createAssignment', 'listAssignments', 'deleteAssignment', 'searchAssignments', 'searchAllAssignments', 'moveAssignment', 'updateAssignment', 'getBiReservation', 'updateBiReservation']; - for (const methodName of reservationServiceStubMethods) { - const callPromise = this.reservationServiceStub.then( - stub => (...args: Array<{}>) => { - if (this._terminated) { - return Promise.reject('The client has already been closed.'); - } - const func = stub[methodName]; - return func.apply(stub, args); - }, - (err: Error|null|undefined) => () => { - throw err; - }); - - const descriptor = - this.descriptors.page[methodName] || - undefined; - const apiCall = this._gaxModule.createApiCall( - callPromise, - this._defaults[methodName], - descriptor, - this._opts.fallback - ); - - this.innerApiCalls[methodName] = apiCall; - } - - return this.reservationServiceStub; - } - - /** - * The DNS address for this API service. - * @returns {string} The DNS address for this service. - */ - static get servicePath() { - return 'bigqueryreservation.googleapis.com'; - } - - /** - * The DNS address for this API service - same as servicePath(), - * exists for compatibility reasons. - * @returns {string} The DNS address for this service. - */ - static get apiEndpoint() { - return 'bigqueryreservation.googleapis.com'; - } - - /** - * The port for this API service. - * @returns {number} The default port for this service. - */ - static get port() { - return 443; - } - - /** - * The scopes needed to make gRPC calls for every method defined - * in this service. - * @returns {string[]} List of default scopes. - */ - static get scopes() { - return [ - 'https://www.googleapis.com/auth/bigquery', - 'https://www.googleapis.com/auth/cloud-platform' - ]; - } - - getProjectId(): Promise; - getProjectId(callback: Callback): void; - /** - * Return the project ID used by this class. - * @returns {Promise} A promise that resolves to string containing the project ID. - */ - getProjectId(callback?: Callback): - Promise|void { - if (callback) { - this.auth.getProjectId(callback); - return; - } - return this.auth.getProjectId(); - } - - // ------------------- - // -- Service calls -- - // ------------------- -/** - * Creates a new reservation resource. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. Project, location. E.g., - * `projects/myproject/locations/US` - * @param {string} request.reservationId - * The reservation ID. It must only contain lower case alphanumeric - * characters or dashes. It must start with a letter and must not end - * with a dash. Its maximum length is 64 characters. - * @param {google.cloud.bigquery.reservation.v1.Reservation} request.reservation - * Definition of the new reservation to create. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@link google.cloud.bigquery.reservation.v1.Reservation | Reservation}. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) - * for more details and examples. - * @example include:samples/generated/v1/reservation_service.create_reservation.js - * region_tag:bigqueryreservation_v1_generated_ReservationService_CreateReservation_async - */ - createReservation( - request?: protos.google.cloud.bigquery.reservation.v1.ICreateReservationRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.bigquery.reservation.v1.IReservation, - protos.google.cloud.bigquery.reservation.v1.ICreateReservationRequest|undefined, {}|undefined - ]>; - createReservation( - request: protos.google.cloud.bigquery.reservation.v1.ICreateReservationRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.bigquery.reservation.v1.IReservation, - protos.google.cloud.bigquery.reservation.v1.ICreateReservationRequest|null|undefined, - {}|null|undefined>): void; - createReservation( - request: protos.google.cloud.bigquery.reservation.v1.ICreateReservationRequest, - callback: Callback< - protos.google.cloud.bigquery.reservation.v1.IReservation, - protos.google.cloud.bigquery.reservation.v1.ICreateReservationRequest|null|undefined, - {}|null|undefined>): void; - createReservation( - request?: protos.google.cloud.bigquery.reservation.v1.ICreateReservationRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.bigquery.reservation.v1.IReservation, - protos.google.cloud.bigquery.reservation.v1.ICreateReservationRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.bigquery.reservation.v1.IReservation, - protos.google.cloud.bigquery.reservation.v1.ICreateReservationRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.bigquery.reservation.v1.IReservation, - protos.google.cloud.bigquery.reservation.v1.ICreateReservationRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); - this.initialize(); - return this.innerApiCalls.createReservation(request, options, callback); - } -/** - * Returns information about the reservation. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. Resource name of the reservation to retrieve. E.g., - * `projects/myproject/locations/US/reservations/team1-prod` - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@link google.cloud.bigquery.reservation.v1.Reservation | Reservation}. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) - * for more details and examples. - * @example include:samples/generated/v1/reservation_service.get_reservation.js - * region_tag:bigqueryreservation_v1_generated_ReservationService_GetReservation_async - */ - getReservation( - request?: protos.google.cloud.bigquery.reservation.v1.IGetReservationRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.bigquery.reservation.v1.IReservation, - protos.google.cloud.bigquery.reservation.v1.IGetReservationRequest|undefined, {}|undefined - ]>; - getReservation( - request: protos.google.cloud.bigquery.reservation.v1.IGetReservationRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.bigquery.reservation.v1.IReservation, - protos.google.cloud.bigquery.reservation.v1.IGetReservationRequest|null|undefined, - {}|null|undefined>): void; - getReservation( - request: protos.google.cloud.bigquery.reservation.v1.IGetReservationRequest, - callback: Callback< - protos.google.cloud.bigquery.reservation.v1.IReservation, - protos.google.cloud.bigquery.reservation.v1.IGetReservationRequest|null|undefined, - {}|null|undefined>): void; - getReservation( - request?: protos.google.cloud.bigquery.reservation.v1.IGetReservationRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.bigquery.reservation.v1.IReservation, - protos.google.cloud.bigquery.reservation.v1.IGetReservationRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.bigquery.reservation.v1.IReservation, - protos.google.cloud.bigquery.reservation.v1.IGetReservationRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.bigquery.reservation.v1.IReservation, - protos.google.cloud.bigquery.reservation.v1.IGetReservationRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', - }); - this.initialize(); - return this.innerApiCalls.getReservation(request, options, callback); - } -/** - * Deletes a reservation. - * Returns `google.rpc.Code.FAILED_PRECONDITION` when reservation has - * assignments. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. Resource name of the reservation to retrieve. E.g., - * `projects/myproject/locations/US/reservations/team1-prod` - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@link google.protobuf.Empty | Empty}. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) - * for more details and examples. - * @example include:samples/generated/v1/reservation_service.delete_reservation.js - * region_tag:bigqueryreservation_v1_generated_ReservationService_DeleteReservation_async - */ - deleteReservation( - request?: protos.google.cloud.bigquery.reservation.v1.IDeleteReservationRequest, - options?: CallOptions): - Promise<[ - protos.google.protobuf.IEmpty, - protos.google.cloud.bigquery.reservation.v1.IDeleteReservationRequest|undefined, {}|undefined - ]>; - deleteReservation( - request: protos.google.cloud.bigquery.reservation.v1.IDeleteReservationRequest, - options: CallOptions, - callback: Callback< - protos.google.protobuf.IEmpty, - protos.google.cloud.bigquery.reservation.v1.IDeleteReservationRequest|null|undefined, - {}|null|undefined>): void; - deleteReservation( - request: protos.google.cloud.bigquery.reservation.v1.IDeleteReservationRequest, - callback: Callback< - protos.google.protobuf.IEmpty, - protos.google.cloud.bigquery.reservation.v1.IDeleteReservationRequest|null|undefined, - {}|null|undefined>): void; - deleteReservation( - request?: protos.google.cloud.bigquery.reservation.v1.IDeleteReservationRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.protobuf.IEmpty, - protos.google.cloud.bigquery.reservation.v1.IDeleteReservationRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.protobuf.IEmpty, - protos.google.cloud.bigquery.reservation.v1.IDeleteReservationRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.protobuf.IEmpty, - protos.google.cloud.bigquery.reservation.v1.IDeleteReservationRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', - }); - this.initialize(); - return this.innerApiCalls.deleteReservation(request, options, callback); - } -/** - * Updates an existing reservation resource. - * - * @param {Object} request - * The request object that will be sent. - * @param {google.cloud.bigquery.reservation.v1.Reservation} request.reservation - * Content of the reservation to update. - * @param {google.protobuf.FieldMask} request.updateMask - * Standard field mask for the set of fields to be updated. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@link google.cloud.bigquery.reservation.v1.Reservation | Reservation}. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) - * for more details and examples. - * @example include:samples/generated/v1/reservation_service.update_reservation.js - * region_tag:bigqueryreservation_v1_generated_ReservationService_UpdateReservation_async - */ - updateReservation( - request?: protos.google.cloud.bigquery.reservation.v1.IUpdateReservationRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.bigquery.reservation.v1.IReservation, - protos.google.cloud.bigquery.reservation.v1.IUpdateReservationRequest|undefined, {}|undefined - ]>; - updateReservation( - request: protos.google.cloud.bigquery.reservation.v1.IUpdateReservationRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.bigquery.reservation.v1.IReservation, - protos.google.cloud.bigquery.reservation.v1.IUpdateReservationRequest|null|undefined, - {}|null|undefined>): void; - updateReservation( - request: protos.google.cloud.bigquery.reservation.v1.IUpdateReservationRequest, - callback: Callback< - protos.google.cloud.bigquery.reservation.v1.IReservation, - protos.google.cloud.bigquery.reservation.v1.IUpdateReservationRequest|null|undefined, - {}|null|undefined>): void; - updateReservation( - request?: protos.google.cloud.bigquery.reservation.v1.IUpdateReservationRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.bigquery.reservation.v1.IReservation, - protos.google.cloud.bigquery.reservation.v1.IUpdateReservationRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.bigquery.reservation.v1.IReservation, - protos.google.cloud.bigquery.reservation.v1.IUpdateReservationRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.bigquery.reservation.v1.IReservation, - protos.google.cloud.bigquery.reservation.v1.IUpdateReservationRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'reservation.name': request.reservation!.name ?? '', - }); - this.initialize(); - return this.innerApiCalls.updateReservation(request, options, callback); - } -/** - * Creates a new capacity commitment resource. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. Resource name of the parent reservation. E.g., - * `projects/myproject/locations/US` - * @param {google.cloud.bigquery.reservation.v1.CapacityCommitment} request.capacityCommitment - * Content of the capacity commitment to create. - * @param {boolean} request.enforceSingleAdminProjectPerOrg - * If true, fail the request if another project in the organization has a - * capacity commitment. - * @param {string} request.capacityCommitmentId - * 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 dashes. - * The first and last character cannot be a dash. Max length is 64 characters. - * NOTE: this ID won't be kept if the capacity commitment is split or merged. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@link google.cloud.bigquery.reservation.v1.CapacityCommitment | CapacityCommitment}. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) - * for more details and examples. - * @example include:samples/generated/v1/reservation_service.create_capacity_commitment.js - * region_tag:bigqueryreservation_v1_generated_ReservationService_CreateCapacityCommitment_async - */ - createCapacityCommitment( - request?: protos.google.cloud.bigquery.reservation.v1.ICreateCapacityCommitmentRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.bigquery.reservation.v1.ICapacityCommitment, - protos.google.cloud.bigquery.reservation.v1.ICreateCapacityCommitmentRequest|undefined, {}|undefined - ]>; - createCapacityCommitment( - request: protos.google.cloud.bigquery.reservation.v1.ICreateCapacityCommitmentRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.bigquery.reservation.v1.ICapacityCommitment, - protos.google.cloud.bigquery.reservation.v1.ICreateCapacityCommitmentRequest|null|undefined, - {}|null|undefined>): void; - createCapacityCommitment( - request: protos.google.cloud.bigquery.reservation.v1.ICreateCapacityCommitmentRequest, - callback: Callback< - protos.google.cloud.bigquery.reservation.v1.ICapacityCommitment, - protos.google.cloud.bigquery.reservation.v1.ICreateCapacityCommitmentRequest|null|undefined, - {}|null|undefined>): void; - createCapacityCommitment( - request?: protos.google.cloud.bigquery.reservation.v1.ICreateCapacityCommitmentRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.bigquery.reservation.v1.ICapacityCommitment, - protos.google.cloud.bigquery.reservation.v1.ICreateCapacityCommitmentRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.bigquery.reservation.v1.ICapacityCommitment, - protos.google.cloud.bigquery.reservation.v1.ICreateCapacityCommitmentRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.bigquery.reservation.v1.ICapacityCommitment, - protos.google.cloud.bigquery.reservation.v1.ICreateCapacityCommitmentRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); - this.initialize(); - return this.innerApiCalls.createCapacityCommitment(request, options, callback); - } -/** - * Returns information about the capacity commitment. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. Resource name of the capacity commitment to retrieve. E.g., - * `projects/myproject/locations/US/capacityCommitments/123` - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@link google.cloud.bigquery.reservation.v1.CapacityCommitment | CapacityCommitment}. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) - * for more details and examples. - * @example include:samples/generated/v1/reservation_service.get_capacity_commitment.js - * region_tag:bigqueryreservation_v1_generated_ReservationService_GetCapacityCommitment_async - */ - getCapacityCommitment( - request?: protos.google.cloud.bigquery.reservation.v1.IGetCapacityCommitmentRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.bigquery.reservation.v1.ICapacityCommitment, - protos.google.cloud.bigquery.reservation.v1.IGetCapacityCommitmentRequest|undefined, {}|undefined - ]>; - getCapacityCommitment( - request: protos.google.cloud.bigquery.reservation.v1.IGetCapacityCommitmentRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.bigquery.reservation.v1.ICapacityCommitment, - protos.google.cloud.bigquery.reservation.v1.IGetCapacityCommitmentRequest|null|undefined, - {}|null|undefined>): void; - getCapacityCommitment( - request: protos.google.cloud.bigquery.reservation.v1.IGetCapacityCommitmentRequest, - callback: Callback< - protos.google.cloud.bigquery.reservation.v1.ICapacityCommitment, - protos.google.cloud.bigquery.reservation.v1.IGetCapacityCommitmentRequest|null|undefined, - {}|null|undefined>): void; - getCapacityCommitment( - request?: protos.google.cloud.bigquery.reservation.v1.IGetCapacityCommitmentRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.bigquery.reservation.v1.ICapacityCommitment, - protos.google.cloud.bigquery.reservation.v1.IGetCapacityCommitmentRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.bigquery.reservation.v1.ICapacityCommitment, - protos.google.cloud.bigquery.reservation.v1.IGetCapacityCommitmentRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.bigquery.reservation.v1.ICapacityCommitment, - protos.google.cloud.bigquery.reservation.v1.IGetCapacityCommitmentRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', - }); - this.initialize(); - return this.innerApiCalls.getCapacityCommitment(request, options, callback); - } -/** - * Deletes a capacity commitment. Attempting to delete capacity commitment - * before its commitment_end_time will fail with the error code - * `google.rpc.Code.FAILED_PRECONDITION`. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. Resource name of the capacity commitment to delete. E.g., - * `projects/myproject/locations/US/capacityCommitments/123` - * @param {boolean} request.force - * 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. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@link google.protobuf.Empty | Empty}. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) - * for more details and examples. - * @example include:samples/generated/v1/reservation_service.delete_capacity_commitment.js - * region_tag:bigqueryreservation_v1_generated_ReservationService_DeleteCapacityCommitment_async - */ - deleteCapacityCommitment( - request?: protos.google.cloud.bigquery.reservation.v1.IDeleteCapacityCommitmentRequest, - options?: CallOptions): - Promise<[ - protos.google.protobuf.IEmpty, - protos.google.cloud.bigquery.reservation.v1.IDeleteCapacityCommitmentRequest|undefined, {}|undefined - ]>; - deleteCapacityCommitment( - request: protos.google.cloud.bigquery.reservation.v1.IDeleteCapacityCommitmentRequest, - options: CallOptions, - callback: Callback< - protos.google.protobuf.IEmpty, - protos.google.cloud.bigquery.reservation.v1.IDeleteCapacityCommitmentRequest|null|undefined, - {}|null|undefined>): void; - deleteCapacityCommitment( - request: protos.google.cloud.bigquery.reservation.v1.IDeleteCapacityCommitmentRequest, - callback: Callback< - protos.google.protobuf.IEmpty, - protos.google.cloud.bigquery.reservation.v1.IDeleteCapacityCommitmentRequest|null|undefined, - {}|null|undefined>): void; - deleteCapacityCommitment( - request?: protos.google.cloud.bigquery.reservation.v1.IDeleteCapacityCommitmentRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.protobuf.IEmpty, - protos.google.cloud.bigquery.reservation.v1.IDeleteCapacityCommitmentRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.protobuf.IEmpty, - protos.google.cloud.bigquery.reservation.v1.IDeleteCapacityCommitmentRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.protobuf.IEmpty, - protos.google.cloud.bigquery.reservation.v1.IDeleteCapacityCommitmentRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', - }); - this.initialize(); - return this.innerApiCalls.deleteCapacityCommitment(request, options, callback); - } -/** - * Updates an existing capacity commitment. - * - * Only `plan` and `renewal_plan` fields can be updated. - * - * Plan can only be changed to a plan of a longer commitment period. - * Attempting to change to a plan with shorter commitment period will fail - * with the error code `google.rpc.Code.FAILED_PRECONDITION`. - * - * @param {Object} request - * The request object that will be sent. - * @param {google.cloud.bigquery.reservation.v1.CapacityCommitment} request.capacityCommitment - * Content of the capacity commitment to update. - * @param {google.protobuf.FieldMask} request.updateMask - * Standard field mask for the set of fields to be updated. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@link google.cloud.bigquery.reservation.v1.CapacityCommitment | CapacityCommitment}. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) - * for more details and examples. - * @example include:samples/generated/v1/reservation_service.update_capacity_commitment.js - * region_tag:bigqueryreservation_v1_generated_ReservationService_UpdateCapacityCommitment_async - */ - updateCapacityCommitment( - request?: protos.google.cloud.bigquery.reservation.v1.IUpdateCapacityCommitmentRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.bigquery.reservation.v1.ICapacityCommitment, - protos.google.cloud.bigquery.reservation.v1.IUpdateCapacityCommitmentRequest|undefined, {}|undefined - ]>; - updateCapacityCommitment( - request: protos.google.cloud.bigquery.reservation.v1.IUpdateCapacityCommitmentRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.bigquery.reservation.v1.ICapacityCommitment, - protos.google.cloud.bigquery.reservation.v1.IUpdateCapacityCommitmentRequest|null|undefined, - {}|null|undefined>): void; - updateCapacityCommitment( - request: protos.google.cloud.bigquery.reservation.v1.IUpdateCapacityCommitmentRequest, - callback: Callback< - protos.google.cloud.bigquery.reservation.v1.ICapacityCommitment, - protos.google.cloud.bigquery.reservation.v1.IUpdateCapacityCommitmentRequest|null|undefined, - {}|null|undefined>): void; - updateCapacityCommitment( - request?: protos.google.cloud.bigquery.reservation.v1.IUpdateCapacityCommitmentRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.bigquery.reservation.v1.ICapacityCommitment, - protos.google.cloud.bigquery.reservation.v1.IUpdateCapacityCommitmentRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.bigquery.reservation.v1.ICapacityCommitment, - protos.google.cloud.bigquery.reservation.v1.IUpdateCapacityCommitmentRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.bigquery.reservation.v1.ICapacityCommitment, - protos.google.cloud.bigquery.reservation.v1.IUpdateCapacityCommitmentRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'capacity_commitment.name': request.capacityCommitment!.name ?? '', - }); - this.initialize(); - return this.innerApiCalls.updateCapacityCommitment(request, options, callback); - } -/** - * Splits capacity commitment to two commitments of the same plan and - * `commitment_end_time`. - * - * A common use case is to enable downgrading commitments. - * - * For example, in order to downgrade from 10000 slots to 8000, you might - * split a 10000 capacity commitment into commitments of 2000 and 8000. Then, - * you delete the first one after the commitment end time passes. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The resource name e.g.,: - * `projects/myproject/locations/US/capacityCommitments/123` - * @param {number} request.slotCount - * Number of slots in the capacity commitment after the split. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@link google.cloud.bigquery.reservation.v1.SplitCapacityCommitmentResponse | SplitCapacityCommitmentResponse}. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) - * for more details and examples. - * @example include:samples/generated/v1/reservation_service.split_capacity_commitment.js - * region_tag:bigqueryreservation_v1_generated_ReservationService_SplitCapacityCommitment_async - */ - splitCapacityCommitment( - request?: protos.google.cloud.bigquery.reservation.v1.ISplitCapacityCommitmentRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.bigquery.reservation.v1.ISplitCapacityCommitmentResponse, - protos.google.cloud.bigquery.reservation.v1.ISplitCapacityCommitmentRequest|undefined, {}|undefined - ]>; - splitCapacityCommitment( - request: protos.google.cloud.bigquery.reservation.v1.ISplitCapacityCommitmentRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.bigquery.reservation.v1.ISplitCapacityCommitmentResponse, - protos.google.cloud.bigquery.reservation.v1.ISplitCapacityCommitmentRequest|null|undefined, - {}|null|undefined>): void; - splitCapacityCommitment( - request: protos.google.cloud.bigquery.reservation.v1.ISplitCapacityCommitmentRequest, - callback: Callback< - protos.google.cloud.bigquery.reservation.v1.ISplitCapacityCommitmentResponse, - protos.google.cloud.bigquery.reservation.v1.ISplitCapacityCommitmentRequest|null|undefined, - {}|null|undefined>): void; - splitCapacityCommitment( - request?: protos.google.cloud.bigquery.reservation.v1.ISplitCapacityCommitmentRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.bigquery.reservation.v1.ISplitCapacityCommitmentResponse, - protos.google.cloud.bigquery.reservation.v1.ISplitCapacityCommitmentRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.bigquery.reservation.v1.ISplitCapacityCommitmentResponse, - protos.google.cloud.bigquery.reservation.v1.ISplitCapacityCommitmentRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.bigquery.reservation.v1.ISplitCapacityCommitmentResponse, - protos.google.cloud.bigquery.reservation.v1.ISplitCapacityCommitmentRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', - }); - this.initialize(); - return this.innerApiCalls.splitCapacityCommitment(request, options, callback); - } -/** - * Merges capacity commitments of the same plan into a single commitment. - * - * The resulting capacity commitment has the greater commitment_end_time - * out of the to-be-merged capacity commitments. - * - * Attempting to merge capacity commitments of different plan will fail - * with the error code `google.rpc.Code.FAILED_PRECONDITION`. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Parent resource that identifies admin project and location e.g., - * `projects/myproject/locations/us` - * @param {string[]} request.capacityCommitmentIds - * 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 - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@link google.cloud.bigquery.reservation.v1.CapacityCommitment | CapacityCommitment}. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) - * for more details and examples. - * @example include:samples/generated/v1/reservation_service.merge_capacity_commitments.js - * region_tag:bigqueryreservation_v1_generated_ReservationService_MergeCapacityCommitments_async - */ - mergeCapacityCommitments( - request?: protos.google.cloud.bigquery.reservation.v1.IMergeCapacityCommitmentsRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.bigquery.reservation.v1.ICapacityCommitment, - protos.google.cloud.bigquery.reservation.v1.IMergeCapacityCommitmentsRequest|undefined, {}|undefined - ]>; - mergeCapacityCommitments( - request: protos.google.cloud.bigquery.reservation.v1.IMergeCapacityCommitmentsRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.bigquery.reservation.v1.ICapacityCommitment, - protos.google.cloud.bigquery.reservation.v1.IMergeCapacityCommitmentsRequest|null|undefined, - {}|null|undefined>): void; - mergeCapacityCommitments( - request: protos.google.cloud.bigquery.reservation.v1.IMergeCapacityCommitmentsRequest, - callback: Callback< - protos.google.cloud.bigquery.reservation.v1.ICapacityCommitment, - protos.google.cloud.bigquery.reservation.v1.IMergeCapacityCommitmentsRequest|null|undefined, - {}|null|undefined>): void; - mergeCapacityCommitments( - request?: protos.google.cloud.bigquery.reservation.v1.IMergeCapacityCommitmentsRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.bigquery.reservation.v1.ICapacityCommitment, - protos.google.cloud.bigquery.reservation.v1.IMergeCapacityCommitmentsRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.bigquery.reservation.v1.ICapacityCommitment, - protos.google.cloud.bigquery.reservation.v1.IMergeCapacityCommitmentsRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.bigquery.reservation.v1.ICapacityCommitment, - protos.google.cloud.bigquery.reservation.v1.IMergeCapacityCommitmentsRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); - this.initialize(); - return this.innerApiCalls.mergeCapacityCommitments(request, options, callback); - } -/** - * Creates an assignment object which allows the given project to submit jobs - * of a certain type using slots from the specified reservation. - * - * Currently a - * resource (project, folder, organization) can only have one assignment per - * each (job_type, location) combination, and that reservation will be used - * for all jobs of the matching type. - * - * Different assignments can be created on different levels of the - * projects, folders or organization hierarchy. During query execution, - * the assignment is looked up at the project, folder and organization levels - * in that order. The first assignment found is applied to the query. - * - * When creating assignments, it does not matter if other assignments exist at - * higher levels. - * - * Example: - * - * * The organization `organizationA` contains two projects, `project1` - * and `project2`. - * * Assignments for all three entities (`organizationA`, `project1`, and - * `project2`) could all be created and mapped to the same or different - * reservations. - * - * "None" assignments represent an absence of the assignment. Projects - * assigned to None use on-demand pricing. To create a "None" assignment, use - * "none" as a reservation_id in the parent. Example parent: - * `projects/myproject/locations/US/reservations/none`. - * - * Returns `google.rpc.Code.PERMISSION_DENIED` if user does not have - * 'bigquery.admin' permissions on the project using the reservation - * and the project that owns this reservation. - * - * Returns `google.rpc.Code.INVALID_ARGUMENT` when location of the assignment - * does not match location of the reservation. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The parent resource name of the assignment - * E.g. `projects/myproject/locations/US/reservations/team1-prod` - * @param {google.cloud.bigquery.reservation.v1.Assignment} request.assignment - * Assignment resource to create. - * @param {string} request.assignmentId - * 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 dashes. - * Max length is 64 characters. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@link google.cloud.bigquery.reservation.v1.Assignment | Assignment}. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) - * for more details and examples. - * @example include:samples/generated/v1/reservation_service.create_assignment.js - * region_tag:bigqueryreservation_v1_generated_ReservationService_CreateAssignment_async - */ - createAssignment( - request?: protos.google.cloud.bigquery.reservation.v1.ICreateAssignmentRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.bigquery.reservation.v1.IAssignment, - protos.google.cloud.bigquery.reservation.v1.ICreateAssignmentRequest|undefined, {}|undefined - ]>; - createAssignment( - request: protos.google.cloud.bigquery.reservation.v1.ICreateAssignmentRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.bigquery.reservation.v1.IAssignment, - protos.google.cloud.bigquery.reservation.v1.ICreateAssignmentRequest|null|undefined, - {}|null|undefined>): void; - createAssignment( - request: protos.google.cloud.bigquery.reservation.v1.ICreateAssignmentRequest, - callback: Callback< - protos.google.cloud.bigquery.reservation.v1.IAssignment, - protos.google.cloud.bigquery.reservation.v1.ICreateAssignmentRequest|null|undefined, - {}|null|undefined>): void; - createAssignment( - request?: protos.google.cloud.bigquery.reservation.v1.ICreateAssignmentRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.bigquery.reservation.v1.IAssignment, - protos.google.cloud.bigquery.reservation.v1.ICreateAssignmentRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.bigquery.reservation.v1.IAssignment, - protos.google.cloud.bigquery.reservation.v1.ICreateAssignmentRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.bigquery.reservation.v1.IAssignment, - protos.google.cloud.bigquery.reservation.v1.ICreateAssignmentRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); - this.initialize(); - return this.innerApiCalls.createAssignment(request, options, callback); - } -/** - * Deletes a assignment. No expansion will happen. - * - * Example: - * - * * Organization `organizationA` contains two projects, `project1` and - * `project2`. - * * Reservation `res1` exists and was created previously. - * * CreateAssignment was used previously to define the following - * associations between entities and reservations: `` - * and `` - * - * In this example, deletion of the `` assignment won't - * affect the other assignment ``. After said deletion, - * queries from `project1` will still use `res1` while queries from - * `project2` will switch to use on-demand mode. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. Name of the resource, e.g. - * `projects/myproject/locations/US/reservations/team1-prod/assignments/123` - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@link google.protobuf.Empty | Empty}. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) - * for more details and examples. - * @example include:samples/generated/v1/reservation_service.delete_assignment.js - * region_tag:bigqueryreservation_v1_generated_ReservationService_DeleteAssignment_async - */ - deleteAssignment( - request?: protos.google.cloud.bigquery.reservation.v1.IDeleteAssignmentRequest, - options?: CallOptions): - Promise<[ - protos.google.protobuf.IEmpty, - protos.google.cloud.bigquery.reservation.v1.IDeleteAssignmentRequest|undefined, {}|undefined - ]>; - deleteAssignment( - request: protos.google.cloud.bigquery.reservation.v1.IDeleteAssignmentRequest, - options: CallOptions, - callback: Callback< - protos.google.protobuf.IEmpty, - protos.google.cloud.bigquery.reservation.v1.IDeleteAssignmentRequest|null|undefined, - {}|null|undefined>): void; - deleteAssignment( - request: protos.google.cloud.bigquery.reservation.v1.IDeleteAssignmentRequest, - callback: Callback< - protos.google.protobuf.IEmpty, - protos.google.cloud.bigquery.reservation.v1.IDeleteAssignmentRequest|null|undefined, - {}|null|undefined>): void; - deleteAssignment( - request?: protos.google.cloud.bigquery.reservation.v1.IDeleteAssignmentRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.protobuf.IEmpty, - protos.google.cloud.bigquery.reservation.v1.IDeleteAssignmentRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.protobuf.IEmpty, - protos.google.cloud.bigquery.reservation.v1.IDeleteAssignmentRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.protobuf.IEmpty, - protos.google.cloud.bigquery.reservation.v1.IDeleteAssignmentRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', - }); - this.initialize(); - return this.innerApiCalls.deleteAssignment(request, options, callback); - } -/** - * Moves an assignment under a new reservation. - * - * This differs from removing an existing assignment and recreating a new one - * by providing a transactional change that ensures an assignee always has an - * associated reservation. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The resource name of the assignment, - * e.g. - * `projects/myproject/locations/US/reservations/team1-prod/assignments/123` - * @param {string} request.destinationId - * The new reservation ID, e.g.: - * `projects/myotherproject/locations/US/reservations/team2-prod` - * @param {string} request.assignmentId - * The optional assignment ID. A new assignment name is generated if this - * field is empty. - * - * This field can contain only lowercase alphanumeric characters or dashes. - * Max length is 64 characters. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@link google.cloud.bigquery.reservation.v1.Assignment | Assignment}. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) - * for more details and examples. - * @example include:samples/generated/v1/reservation_service.move_assignment.js - * region_tag:bigqueryreservation_v1_generated_ReservationService_MoveAssignment_async - */ - moveAssignment( - request?: protos.google.cloud.bigquery.reservation.v1.IMoveAssignmentRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.bigquery.reservation.v1.IAssignment, - protos.google.cloud.bigquery.reservation.v1.IMoveAssignmentRequest|undefined, {}|undefined - ]>; - moveAssignment( - request: protos.google.cloud.bigquery.reservation.v1.IMoveAssignmentRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.bigquery.reservation.v1.IAssignment, - protos.google.cloud.bigquery.reservation.v1.IMoveAssignmentRequest|null|undefined, - {}|null|undefined>): void; - moveAssignment( - request: protos.google.cloud.bigquery.reservation.v1.IMoveAssignmentRequest, - callback: Callback< - protos.google.cloud.bigquery.reservation.v1.IAssignment, - protos.google.cloud.bigquery.reservation.v1.IMoveAssignmentRequest|null|undefined, - {}|null|undefined>): void; - moveAssignment( - request?: protos.google.cloud.bigquery.reservation.v1.IMoveAssignmentRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.bigquery.reservation.v1.IAssignment, - protos.google.cloud.bigquery.reservation.v1.IMoveAssignmentRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.bigquery.reservation.v1.IAssignment, - protos.google.cloud.bigquery.reservation.v1.IMoveAssignmentRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.bigquery.reservation.v1.IAssignment, - protos.google.cloud.bigquery.reservation.v1.IMoveAssignmentRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', - }); - this.initialize(); - return this.innerApiCalls.moveAssignment(request, options, callback); - } -/** - * Updates an existing assignment. - * - * Only the `priority` field can be updated. - * - * @param {Object} request - * The request object that will be sent. - * @param {google.cloud.bigquery.reservation.v1.Assignment} request.assignment - * Content of the assignment to update. - * @param {google.protobuf.FieldMask} request.updateMask - * Standard field mask for the set of fields to be updated. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@link google.cloud.bigquery.reservation.v1.Assignment | Assignment}. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) - * for more details and examples. - * @example include:samples/generated/v1/reservation_service.update_assignment.js - * region_tag:bigqueryreservation_v1_generated_ReservationService_UpdateAssignment_async - */ - updateAssignment( - request?: protos.google.cloud.bigquery.reservation.v1.IUpdateAssignmentRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.bigquery.reservation.v1.IAssignment, - protos.google.cloud.bigquery.reservation.v1.IUpdateAssignmentRequest|undefined, {}|undefined - ]>; - updateAssignment( - request: protos.google.cloud.bigquery.reservation.v1.IUpdateAssignmentRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.bigquery.reservation.v1.IAssignment, - protos.google.cloud.bigquery.reservation.v1.IUpdateAssignmentRequest|null|undefined, - {}|null|undefined>): void; - updateAssignment( - request: protos.google.cloud.bigquery.reservation.v1.IUpdateAssignmentRequest, - callback: Callback< - protos.google.cloud.bigquery.reservation.v1.IAssignment, - protos.google.cloud.bigquery.reservation.v1.IUpdateAssignmentRequest|null|undefined, - {}|null|undefined>): void; - updateAssignment( - request?: protos.google.cloud.bigquery.reservation.v1.IUpdateAssignmentRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.bigquery.reservation.v1.IAssignment, - protos.google.cloud.bigquery.reservation.v1.IUpdateAssignmentRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.bigquery.reservation.v1.IAssignment, - protos.google.cloud.bigquery.reservation.v1.IUpdateAssignmentRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.bigquery.reservation.v1.IAssignment, - protos.google.cloud.bigquery.reservation.v1.IUpdateAssignmentRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'assignment.name': request.assignment!.name ?? '', - }); - this.initialize(); - return this.innerApiCalls.updateAssignment(request, options, callback); - } -/** - * Retrieves a BI reservation. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. Name of the requested reservation, for example: - * `projects/{project_id}/locations/{location_id}/biReservation` - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@link google.cloud.bigquery.reservation.v1.BiReservation | BiReservation}. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) - * for more details and examples. - * @example include:samples/generated/v1/reservation_service.get_bi_reservation.js - * region_tag:bigqueryreservation_v1_generated_ReservationService_GetBiReservation_async - */ - getBiReservation( - request?: protos.google.cloud.bigquery.reservation.v1.IGetBiReservationRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.bigquery.reservation.v1.IBiReservation, - protos.google.cloud.bigquery.reservation.v1.IGetBiReservationRequest|undefined, {}|undefined - ]>; - getBiReservation( - request: protos.google.cloud.bigquery.reservation.v1.IGetBiReservationRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.bigquery.reservation.v1.IBiReservation, - protos.google.cloud.bigquery.reservation.v1.IGetBiReservationRequest|null|undefined, - {}|null|undefined>): void; - getBiReservation( - request: protos.google.cloud.bigquery.reservation.v1.IGetBiReservationRequest, - callback: Callback< - protos.google.cloud.bigquery.reservation.v1.IBiReservation, - protos.google.cloud.bigquery.reservation.v1.IGetBiReservationRequest|null|undefined, - {}|null|undefined>): void; - getBiReservation( - request?: protos.google.cloud.bigquery.reservation.v1.IGetBiReservationRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.bigquery.reservation.v1.IBiReservation, - protos.google.cloud.bigquery.reservation.v1.IGetBiReservationRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.bigquery.reservation.v1.IBiReservation, - protos.google.cloud.bigquery.reservation.v1.IGetBiReservationRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.bigquery.reservation.v1.IBiReservation, - protos.google.cloud.bigquery.reservation.v1.IGetBiReservationRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', - }); - this.initialize(); - return this.innerApiCalls.getBiReservation(request, options, callback); - } -/** - * Updates a BI reservation. - * - * Only fields specified in the `field_mask` are updated. - * - * A singleton BI reservation always exists with default size 0. - * In order to reserve BI capacity it needs to be updated to an amount - * greater than 0. In order to release BI capacity reservation size - * must be set to 0. - * - * @param {Object} request - * The request object that will be sent. - * @param {google.cloud.bigquery.reservation.v1.BiReservation} request.biReservation - * A reservation to update. - * @param {google.protobuf.FieldMask} request.updateMask - * A list of fields to be updated in this request. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@link google.cloud.bigquery.reservation.v1.BiReservation | BiReservation}. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) - * for more details and examples. - * @example include:samples/generated/v1/reservation_service.update_bi_reservation.js - * region_tag:bigqueryreservation_v1_generated_ReservationService_UpdateBiReservation_async - */ - updateBiReservation( - request?: protos.google.cloud.bigquery.reservation.v1.IUpdateBiReservationRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.bigquery.reservation.v1.IBiReservation, - protos.google.cloud.bigquery.reservation.v1.IUpdateBiReservationRequest|undefined, {}|undefined - ]>; - updateBiReservation( - request: protos.google.cloud.bigquery.reservation.v1.IUpdateBiReservationRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.bigquery.reservation.v1.IBiReservation, - protos.google.cloud.bigquery.reservation.v1.IUpdateBiReservationRequest|null|undefined, - {}|null|undefined>): void; - updateBiReservation( - request: protos.google.cloud.bigquery.reservation.v1.IUpdateBiReservationRequest, - callback: Callback< - protos.google.cloud.bigquery.reservation.v1.IBiReservation, - protos.google.cloud.bigquery.reservation.v1.IUpdateBiReservationRequest|null|undefined, - {}|null|undefined>): void; - updateBiReservation( - request?: protos.google.cloud.bigquery.reservation.v1.IUpdateBiReservationRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.bigquery.reservation.v1.IBiReservation, - protos.google.cloud.bigquery.reservation.v1.IUpdateBiReservationRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.bigquery.reservation.v1.IBiReservation, - protos.google.cloud.bigquery.reservation.v1.IUpdateBiReservationRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.bigquery.reservation.v1.IBiReservation, - protos.google.cloud.bigquery.reservation.v1.IUpdateBiReservationRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'bi_reservation.name': request.biReservation!.name ?? '', - }); - this.initialize(); - return this.innerApiCalls.updateBiReservation(request, options, callback); - } - - /** - * Lists all the reservations for the project in the specified location. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The parent resource name containing project and location, e.g.: - * `projects/myproject/locations/US` - * @param {number} request.pageSize - * The maximum number of items to return per page. - * @param {string} request.pageToken - * The next_page_token value returned from a previous List request, if any. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is Array of {@link google.cloud.bigquery.reservation.v1.Reservation | Reservation}. - * The client library will perform auto-pagination by default: it will call the API as many - * times as needed and will merge results from all the pages into this array. - * Note that it can affect your quota. - * We recommend using `listReservationsAsync()` - * method described below for async iteration which you can stop as needed. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) - * for more details and examples. - */ - listReservations( - request?: protos.google.cloud.bigquery.reservation.v1.IListReservationsRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.bigquery.reservation.v1.IReservation[], - protos.google.cloud.bigquery.reservation.v1.IListReservationsRequest|null, - protos.google.cloud.bigquery.reservation.v1.IListReservationsResponse - ]>; - listReservations( - request: protos.google.cloud.bigquery.reservation.v1.IListReservationsRequest, - options: CallOptions, - callback: PaginationCallback< - protos.google.cloud.bigquery.reservation.v1.IListReservationsRequest, - protos.google.cloud.bigquery.reservation.v1.IListReservationsResponse|null|undefined, - protos.google.cloud.bigquery.reservation.v1.IReservation>): void; - listReservations( - request: protos.google.cloud.bigquery.reservation.v1.IListReservationsRequest, - callback: PaginationCallback< - protos.google.cloud.bigquery.reservation.v1.IListReservationsRequest, - protos.google.cloud.bigquery.reservation.v1.IListReservationsResponse|null|undefined, - protos.google.cloud.bigquery.reservation.v1.IReservation>): void; - listReservations( - request?: protos.google.cloud.bigquery.reservation.v1.IListReservationsRequest, - optionsOrCallback?: CallOptions|PaginationCallback< - protos.google.cloud.bigquery.reservation.v1.IListReservationsRequest, - protos.google.cloud.bigquery.reservation.v1.IListReservationsResponse|null|undefined, - protos.google.cloud.bigquery.reservation.v1.IReservation>, - callback?: PaginationCallback< - protos.google.cloud.bigquery.reservation.v1.IListReservationsRequest, - protos.google.cloud.bigquery.reservation.v1.IListReservationsResponse|null|undefined, - protos.google.cloud.bigquery.reservation.v1.IReservation>): - Promise<[ - protos.google.cloud.bigquery.reservation.v1.IReservation[], - protos.google.cloud.bigquery.reservation.v1.IListReservationsRequest|null, - protos.google.cloud.bigquery.reservation.v1.IListReservationsResponse - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); - this.initialize(); - return this.innerApiCalls.listReservations(request, options, callback); - } - -/** - * Equivalent to `method.name.toCamelCase()`, but returns a NodeJS Stream object. - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The parent resource name containing project and location, e.g.: - * `projects/myproject/locations/US` - * @param {number} request.pageSize - * The maximum number of items to return per page. - * @param {string} request.pageToken - * The next_page_token value returned from a previous List request, if any. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Stream} - * An object stream which emits an object representing {@link google.cloud.bigquery.reservation.v1.Reservation | Reservation} on 'data' event. - * The client library will perform auto-pagination by default: it will call the API as many - * times as needed. Note that it can affect your quota. - * We recommend using `listReservationsAsync()` - * method described below for async iteration which you can stop as needed. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) - * for more details and examples. - */ - listReservationsStream( - request?: protos.google.cloud.bigquery.reservation.v1.IListReservationsRequest, - options?: CallOptions): - Transform{ - request = request || {}; - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); - const defaultCallSettings = this._defaults['listReservations']; - const callSettings = defaultCallSettings.merge(options); - this.initialize(); - return this.descriptors.page.listReservations.createStream( - this.innerApiCalls.listReservations as GaxCall, - request, - callSettings - ); - } - -/** - * Equivalent to `listReservations`, but returns an iterable object. - * - * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The parent resource name containing project and location, e.g.: - * `projects/myproject/locations/US` - * @param {number} request.pageSize - * The maximum number of items to return per page. - * @param {string} request.pageToken - * The next_page_token value returned from a previous List request, if any. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Object} - * An iterable Object that allows [async iteration](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols). - * When you iterate the returned iterable, each element will be an object representing - * {@link google.cloud.bigquery.reservation.v1.Reservation | Reservation}. The API will be called under the hood as needed, once per the page, - * so you can stop the iteration when you don't need more results. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) - * for more details and examples. - * @example include:samples/generated/v1/reservation_service.list_reservations.js - * region_tag:bigqueryreservation_v1_generated_ReservationService_ListReservations_async - */ - listReservationsAsync( - request?: protos.google.cloud.bigquery.reservation.v1.IListReservationsRequest, - options?: CallOptions): - AsyncIterable{ - request = request || {}; - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); - const defaultCallSettings = this._defaults['listReservations']; - const callSettings = defaultCallSettings.merge(options); - this.initialize(); - return this.descriptors.page.listReservations.asyncIterate( - this.innerApiCalls['listReservations'] as GaxCall, - request as {}, - callSettings - ) as AsyncIterable; - } - /** - * Lists all the capacity commitments for the admin project. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. Resource name of the parent reservation. E.g., - * `projects/myproject/locations/US` - * @param {number} request.pageSize - * The maximum number of items to return. - * @param {string} request.pageToken - * The next_page_token value returned from a previous List request, if any. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is Array of {@link google.cloud.bigquery.reservation.v1.CapacityCommitment | CapacityCommitment}. - * The client library will perform auto-pagination by default: it will call the API as many - * times as needed and will merge results from all the pages into this array. - * Note that it can affect your quota. - * We recommend using `listCapacityCommitmentsAsync()` - * method described below for async iteration which you can stop as needed. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) - * for more details and examples. - */ - listCapacityCommitments( - request?: protos.google.cloud.bigquery.reservation.v1.IListCapacityCommitmentsRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.bigquery.reservation.v1.ICapacityCommitment[], - protos.google.cloud.bigquery.reservation.v1.IListCapacityCommitmentsRequest|null, - protos.google.cloud.bigquery.reservation.v1.IListCapacityCommitmentsResponse - ]>; - listCapacityCommitments( - request: protos.google.cloud.bigquery.reservation.v1.IListCapacityCommitmentsRequest, - options: CallOptions, - callback: PaginationCallback< - protos.google.cloud.bigquery.reservation.v1.IListCapacityCommitmentsRequest, - protos.google.cloud.bigquery.reservation.v1.IListCapacityCommitmentsResponse|null|undefined, - protos.google.cloud.bigquery.reservation.v1.ICapacityCommitment>): void; - listCapacityCommitments( - request: protos.google.cloud.bigquery.reservation.v1.IListCapacityCommitmentsRequest, - callback: PaginationCallback< - protos.google.cloud.bigquery.reservation.v1.IListCapacityCommitmentsRequest, - protos.google.cloud.bigquery.reservation.v1.IListCapacityCommitmentsResponse|null|undefined, - protos.google.cloud.bigquery.reservation.v1.ICapacityCommitment>): void; - listCapacityCommitments( - request?: protos.google.cloud.bigquery.reservation.v1.IListCapacityCommitmentsRequest, - optionsOrCallback?: CallOptions|PaginationCallback< - protos.google.cloud.bigquery.reservation.v1.IListCapacityCommitmentsRequest, - protos.google.cloud.bigquery.reservation.v1.IListCapacityCommitmentsResponse|null|undefined, - protos.google.cloud.bigquery.reservation.v1.ICapacityCommitment>, - callback?: PaginationCallback< - protos.google.cloud.bigquery.reservation.v1.IListCapacityCommitmentsRequest, - protos.google.cloud.bigquery.reservation.v1.IListCapacityCommitmentsResponse|null|undefined, - protos.google.cloud.bigquery.reservation.v1.ICapacityCommitment>): - Promise<[ - protos.google.cloud.bigquery.reservation.v1.ICapacityCommitment[], - protos.google.cloud.bigquery.reservation.v1.IListCapacityCommitmentsRequest|null, - protos.google.cloud.bigquery.reservation.v1.IListCapacityCommitmentsResponse - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); - this.initialize(); - return this.innerApiCalls.listCapacityCommitments(request, options, callback); - } - -/** - * Equivalent to `method.name.toCamelCase()`, but returns a NodeJS Stream object. - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. Resource name of the parent reservation. E.g., - * `projects/myproject/locations/US` - * @param {number} request.pageSize - * The maximum number of items to return. - * @param {string} request.pageToken - * The next_page_token value returned from a previous List request, if any. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Stream} - * An object stream which emits an object representing {@link google.cloud.bigquery.reservation.v1.CapacityCommitment | CapacityCommitment} on 'data' event. - * The client library will perform auto-pagination by default: it will call the API as many - * times as needed. Note that it can affect your quota. - * We recommend using `listCapacityCommitmentsAsync()` - * method described below for async iteration which you can stop as needed. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) - * for more details and examples. - */ - listCapacityCommitmentsStream( - request?: protos.google.cloud.bigquery.reservation.v1.IListCapacityCommitmentsRequest, - options?: CallOptions): - Transform{ - request = request || {}; - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); - const defaultCallSettings = this._defaults['listCapacityCommitments']; - const callSettings = defaultCallSettings.merge(options); - this.initialize(); - return this.descriptors.page.listCapacityCommitments.createStream( - this.innerApiCalls.listCapacityCommitments as GaxCall, - request, - callSettings - ); - } - -/** - * Equivalent to `listCapacityCommitments`, but returns an iterable object. - * - * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. Resource name of the parent reservation. E.g., - * `projects/myproject/locations/US` - * @param {number} request.pageSize - * The maximum number of items to return. - * @param {string} request.pageToken - * The next_page_token value returned from a previous List request, if any. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Object} - * An iterable Object that allows [async iteration](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols). - * When you iterate the returned iterable, each element will be an object representing - * {@link google.cloud.bigquery.reservation.v1.CapacityCommitment | CapacityCommitment}. The API will be called under the hood as needed, once per the page, - * so you can stop the iteration when you don't need more results. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) - * for more details and examples. - * @example include:samples/generated/v1/reservation_service.list_capacity_commitments.js - * region_tag:bigqueryreservation_v1_generated_ReservationService_ListCapacityCommitments_async - */ - listCapacityCommitmentsAsync( - request?: protos.google.cloud.bigquery.reservation.v1.IListCapacityCommitmentsRequest, - options?: CallOptions): - AsyncIterable{ - request = request || {}; - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); - const defaultCallSettings = this._defaults['listCapacityCommitments']; - const callSettings = defaultCallSettings.merge(options); - this.initialize(); - return this.descriptors.page.listCapacityCommitments.asyncIterate( - this.innerApiCalls['listCapacityCommitments'] as GaxCall, - request as {}, - callSettings - ) as AsyncIterable; - } - /** - * Lists assignments. - * - * Only explicitly created assignments will be returned. - * - * Example: - * - * * Organization `organizationA` contains two projects, `project1` and - * `project2`. - * * Reservation `res1` exists and was created previously. - * * CreateAssignment was used previously to define the following - * associations between entities and reservations: `` - * and `` - * - * In this example, ListAssignments will just return the above two assignments - * for reservation `res1`, and no expansion/merge will happen. - * - * The wildcard "-" can be used for - * reservations in the request. In that case all assignments belongs to the - * specified project and location will be listed. - * - * **Note** "-" cannot be used for projects nor locations. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The parent resource name e.g.: - * - * `projects/myproject/locations/US/reservations/team1-prod` - * - * Or: - * - * `projects/myproject/locations/US/reservations/-` - * @param {number} request.pageSize - * The maximum number of items to return per page. - * @param {string} request.pageToken - * The next_page_token value returned from a previous List request, if any. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is Array of {@link google.cloud.bigquery.reservation.v1.Assignment | Assignment}. - * The client library will perform auto-pagination by default: it will call the API as many - * times as needed and will merge results from all the pages into this array. - * Note that it can affect your quota. - * We recommend using `listAssignmentsAsync()` - * method described below for async iteration which you can stop as needed. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) - * for more details and examples. - */ - listAssignments( - request?: protos.google.cloud.bigquery.reservation.v1.IListAssignmentsRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.bigquery.reservation.v1.IAssignment[], - protos.google.cloud.bigquery.reservation.v1.IListAssignmentsRequest|null, - protos.google.cloud.bigquery.reservation.v1.IListAssignmentsResponse - ]>; - listAssignments( - request: protos.google.cloud.bigquery.reservation.v1.IListAssignmentsRequest, - options: CallOptions, - callback: PaginationCallback< - protos.google.cloud.bigquery.reservation.v1.IListAssignmentsRequest, - protos.google.cloud.bigquery.reservation.v1.IListAssignmentsResponse|null|undefined, - protos.google.cloud.bigquery.reservation.v1.IAssignment>): void; - listAssignments( - request: protos.google.cloud.bigquery.reservation.v1.IListAssignmentsRequest, - callback: PaginationCallback< - protos.google.cloud.bigquery.reservation.v1.IListAssignmentsRequest, - protos.google.cloud.bigquery.reservation.v1.IListAssignmentsResponse|null|undefined, - protos.google.cloud.bigquery.reservation.v1.IAssignment>): void; - listAssignments( - request?: protos.google.cloud.bigquery.reservation.v1.IListAssignmentsRequest, - optionsOrCallback?: CallOptions|PaginationCallback< - protos.google.cloud.bigquery.reservation.v1.IListAssignmentsRequest, - protos.google.cloud.bigquery.reservation.v1.IListAssignmentsResponse|null|undefined, - protos.google.cloud.bigquery.reservation.v1.IAssignment>, - callback?: PaginationCallback< - protos.google.cloud.bigquery.reservation.v1.IListAssignmentsRequest, - protos.google.cloud.bigquery.reservation.v1.IListAssignmentsResponse|null|undefined, - protos.google.cloud.bigquery.reservation.v1.IAssignment>): - Promise<[ - protos.google.cloud.bigquery.reservation.v1.IAssignment[], - protos.google.cloud.bigquery.reservation.v1.IListAssignmentsRequest|null, - protos.google.cloud.bigquery.reservation.v1.IListAssignmentsResponse - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); - this.initialize(); - return this.innerApiCalls.listAssignments(request, options, callback); - } - -/** - * Equivalent to `method.name.toCamelCase()`, but returns a NodeJS Stream object. - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The parent resource name e.g.: - * - * `projects/myproject/locations/US/reservations/team1-prod` - * - * Or: - * - * `projects/myproject/locations/US/reservations/-` - * @param {number} request.pageSize - * The maximum number of items to return per page. - * @param {string} request.pageToken - * The next_page_token value returned from a previous List request, if any. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Stream} - * An object stream which emits an object representing {@link google.cloud.bigquery.reservation.v1.Assignment | Assignment} on 'data' event. - * The client library will perform auto-pagination by default: it will call the API as many - * times as needed. Note that it can affect your quota. - * We recommend using `listAssignmentsAsync()` - * method described below for async iteration which you can stop as needed. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) - * for more details and examples. - */ - listAssignmentsStream( - request?: protos.google.cloud.bigquery.reservation.v1.IListAssignmentsRequest, - options?: CallOptions): - Transform{ - request = request || {}; - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); - const defaultCallSettings = this._defaults['listAssignments']; - const callSettings = defaultCallSettings.merge(options); - this.initialize(); - return this.descriptors.page.listAssignments.createStream( - this.innerApiCalls.listAssignments as GaxCall, - request, - callSettings - ); - } - -/** - * Equivalent to `listAssignments`, but returns an iterable object. - * - * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The parent resource name e.g.: - * - * `projects/myproject/locations/US/reservations/team1-prod` - * - * Or: - * - * `projects/myproject/locations/US/reservations/-` - * @param {number} request.pageSize - * The maximum number of items to return per page. - * @param {string} request.pageToken - * The next_page_token value returned from a previous List request, if any. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Object} - * An iterable Object that allows [async iteration](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols). - * When you iterate the returned iterable, each element will be an object representing - * {@link google.cloud.bigquery.reservation.v1.Assignment | Assignment}. The API will be called under the hood as needed, once per the page, - * so you can stop the iteration when you don't need more results. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) - * for more details and examples. - * @example include:samples/generated/v1/reservation_service.list_assignments.js - * region_tag:bigqueryreservation_v1_generated_ReservationService_ListAssignments_async - */ - listAssignmentsAsync( - request?: protos.google.cloud.bigquery.reservation.v1.IListAssignmentsRequest, - options?: CallOptions): - AsyncIterable{ - request = request || {}; - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); - const defaultCallSettings = this._defaults['listAssignments']; - const callSettings = defaultCallSettings.merge(options); - this.initialize(); - return this.descriptors.page.listAssignments.asyncIterate( - this.innerApiCalls['listAssignments'] as GaxCall, - request as {}, - callSettings - ) as AsyncIterable; - } - /** - * Deprecated: Looks up assignments for a specified resource for a particular - * region. If the request is about a project: - * - * 1. Assignments created on the project will be returned if they exist. - * 2. Otherwise assignments created on the closest ancestor will be - * returned. - * 3. Assignments for different JobTypes will all be returned. - * - * The same logic applies if the request is about a folder. - * - * If the request is about an organization, then assignments created on the - * organization will be returned (organization doesn't have ancestors). - * - * Comparing to ListAssignments, there are some behavior - * differences: - * - * 1. permission on the assignee will be verified in this API. - * 2. Hierarchy lookup (project->folder->organization) happens in this API. - * 3. Parent here is `projects/* /locations/*`, instead of - * `projects/* /locations/*reservations/*`. - * - * **Note** "-" cannot be used for projects - * nor locations. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The resource name of the admin project(containing project and - * location), e.g.: - * `projects/myproject/locations/US`. - * @param {string} request.query - * Please specify resource name as assignee in the query. - * - * Examples: - * - * * `assignee=projects/myproject` - * * `assignee=folders/123` - * * `assignee=organizations/456` - * @param {number} request.pageSize - * The maximum number of items to return per page. - * @param {string} request.pageToken - * The next_page_token value returned from a previous List request, if any. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is Array of {@link google.cloud.bigquery.reservation.v1.Assignment | Assignment}. - * The client library will perform auto-pagination by default: it will call the API as many - * times as needed and will merge results from all the pages into this array. - * Note that it can affect your quota. - * We recommend using `searchAssignmentsAsync()` - * method described below for async iteration which you can stop as needed. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) - * for more details and examples. - * @deprecated SearchAssignments is deprecated and may be removed in a future version. - */ - searchAssignments( - request?: protos.google.cloud.bigquery.reservation.v1.ISearchAssignmentsRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.bigquery.reservation.v1.IAssignment[], - protos.google.cloud.bigquery.reservation.v1.ISearchAssignmentsRequest|null, - protos.google.cloud.bigquery.reservation.v1.ISearchAssignmentsResponse - ]>; - searchAssignments( - request: protos.google.cloud.bigquery.reservation.v1.ISearchAssignmentsRequest, - options: CallOptions, - callback: PaginationCallback< - protos.google.cloud.bigquery.reservation.v1.ISearchAssignmentsRequest, - protos.google.cloud.bigquery.reservation.v1.ISearchAssignmentsResponse|null|undefined, - protos.google.cloud.bigquery.reservation.v1.IAssignment>): void; - searchAssignments( - request: protos.google.cloud.bigquery.reservation.v1.ISearchAssignmentsRequest, - callback: PaginationCallback< - protos.google.cloud.bigquery.reservation.v1.ISearchAssignmentsRequest, - protos.google.cloud.bigquery.reservation.v1.ISearchAssignmentsResponse|null|undefined, - protos.google.cloud.bigquery.reservation.v1.IAssignment>): void; - searchAssignments( - request?: protos.google.cloud.bigquery.reservation.v1.ISearchAssignmentsRequest, - optionsOrCallback?: CallOptions|PaginationCallback< - protos.google.cloud.bigquery.reservation.v1.ISearchAssignmentsRequest, - protos.google.cloud.bigquery.reservation.v1.ISearchAssignmentsResponse|null|undefined, - protos.google.cloud.bigquery.reservation.v1.IAssignment>, - callback?: PaginationCallback< - protos.google.cloud.bigquery.reservation.v1.ISearchAssignmentsRequest, - protos.google.cloud.bigquery.reservation.v1.ISearchAssignmentsResponse|null|undefined, - protos.google.cloud.bigquery.reservation.v1.IAssignment>): - Promise<[ - protos.google.cloud.bigquery.reservation.v1.IAssignment[], - protos.google.cloud.bigquery.reservation.v1.ISearchAssignmentsRequest|null, - protos.google.cloud.bigquery.reservation.v1.ISearchAssignmentsResponse - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); - this.initialize(); - this.warn('DEP$ReservationService-$SearchAssignments','SearchAssignments is deprecated and may be removed in a future version.', 'DeprecationWarning'); - return this.innerApiCalls.searchAssignments(request, options, callback); - } - -/** - * Equivalent to `method.name.toCamelCase()`, but returns a NodeJS Stream object. - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The resource name of the admin project(containing project and - * location), e.g.: - * `projects/myproject/locations/US`. - * @param {string} request.query - * Please specify resource name as assignee in the query. - * - * Examples: - * - * * `assignee=projects/myproject` - * * `assignee=folders/123` - * * `assignee=organizations/456` - * @param {number} request.pageSize - * The maximum number of items to return per page. - * @param {string} request.pageToken - * The next_page_token value returned from a previous List request, if any. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Stream} - * An object stream which emits an object representing {@link google.cloud.bigquery.reservation.v1.Assignment | Assignment} on 'data' event. - * The client library will perform auto-pagination by default: it will call the API as many - * times as needed. Note that it can affect your quota. - * We recommend using `searchAssignmentsAsync()` - * method described below for async iteration which you can stop as needed. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) - * for more details and examples. - * @deprecated SearchAssignments is deprecated and may be removed in a future version. - */ - searchAssignmentsStream( - request?: protos.google.cloud.bigquery.reservation.v1.ISearchAssignmentsRequest, - options?: CallOptions): - Transform{ - request = request || {}; - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); - const defaultCallSettings = this._defaults['searchAssignments']; - const callSettings = defaultCallSettings.merge(options); - this.initialize(); - this.warn('DEP$ReservationService-$SearchAssignments','SearchAssignments is deprecated and may be removed in a future version.', 'DeprecationWarning'); - return this.descriptors.page.searchAssignments.createStream( - this.innerApiCalls.searchAssignments as GaxCall, - request, - callSettings - ); - } - -/** - * Equivalent to `searchAssignments`, but returns an iterable object. - * - * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The resource name of the admin project(containing project and - * location), e.g.: - * `projects/myproject/locations/US`. - * @param {string} request.query - * Please specify resource name as assignee in the query. - * - * Examples: - * - * * `assignee=projects/myproject` - * * `assignee=folders/123` - * * `assignee=organizations/456` - * @param {number} request.pageSize - * The maximum number of items to return per page. - * @param {string} request.pageToken - * The next_page_token value returned from a previous List request, if any. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Object} - * An iterable Object that allows [async iteration](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols). - * When you iterate the returned iterable, each element will be an object representing - * {@link google.cloud.bigquery.reservation.v1.Assignment | Assignment}. The API will be called under the hood as needed, once per the page, - * so you can stop the iteration when you don't need more results. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) - * for more details and examples. - * @example include:samples/generated/v1/reservation_service.search_assignments.js - * region_tag:bigqueryreservation_v1_generated_ReservationService_SearchAssignments_async - * @deprecated SearchAssignments is deprecated and may be removed in a future version. - */ - searchAssignmentsAsync( - request?: protos.google.cloud.bigquery.reservation.v1.ISearchAssignmentsRequest, - options?: CallOptions): - AsyncIterable{ - request = request || {}; - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); - const defaultCallSettings = this._defaults['searchAssignments']; - const callSettings = defaultCallSettings.merge(options); - this.initialize(); - this.warn('DEP$ReservationService-$SearchAssignments','SearchAssignments is deprecated and may be removed in a future version.', 'DeprecationWarning'); - return this.descriptors.page.searchAssignments.asyncIterate( - this.innerApiCalls['searchAssignments'] as GaxCall, - request as {}, - callSettings - ) as AsyncIterable; - } - /** - * Looks up assignments for a specified resource for a particular region. - * If the request is about a project: - * - * 1. Assignments created on the project will be returned if they exist. - * 2. Otherwise assignments created on the closest ancestor will be - * returned. - * 3. Assignments for different JobTypes will all be returned. - * - * The same logic applies if the request is about a folder. - * - * If the request is about an organization, then assignments created on the - * organization will be returned (organization doesn't have ancestors). - * - * Comparing to ListAssignments, there are some behavior - * differences: - * - * 1. permission on the assignee will be verified in this API. - * 2. Hierarchy lookup (project->folder->organization) happens in this API. - * 3. Parent here is `projects/* /locations/*`, instead of - * `projects/* /locations/*reservations/*`. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The resource name with location (project name could be the - * wildcard '-'), e.g.: - * `projects/-/locations/US`. - * @param {string} request.query - * Please specify resource name as assignee in the query. - * - * Examples: - * - * * `assignee=projects/myproject` - * * `assignee=folders/123` - * * `assignee=organizations/456` - * @param {number} request.pageSize - * The maximum number of items to return per page. - * @param {string} request.pageToken - * The next_page_token value returned from a previous List request, if any. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is Array of {@link google.cloud.bigquery.reservation.v1.Assignment | Assignment}. - * The client library will perform auto-pagination by default: it will call the API as many - * times as needed and will merge results from all the pages into this array. - * Note that it can affect your quota. - * We recommend using `searchAllAssignmentsAsync()` - * method described below for async iteration which you can stop as needed. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) - * for more details and examples. - */ - searchAllAssignments( - request?: protos.google.cloud.bigquery.reservation.v1.ISearchAllAssignmentsRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.bigquery.reservation.v1.IAssignment[], - protos.google.cloud.bigquery.reservation.v1.ISearchAllAssignmentsRequest|null, - protos.google.cloud.bigquery.reservation.v1.ISearchAllAssignmentsResponse - ]>; - searchAllAssignments( - request: protos.google.cloud.bigquery.reservation.v1.ISearchAllAssignmentsRequest, - options: CallOptions, - callback: PaginationCallback< - protos.google.cloud.bigquery.reservation.v1.ISearchAllAssignmentsRequest, - protos.google.cloud.bigquery.reservation.v1.ISearchAllAssignmentsResponse|null|undefined, - protos.google.cloud.bigquery.reservation.v1.IAssignment>): void; - searchAllAssignments( - request: protos.google.cloud.bigquery.reservation.v1.ISearchAllAssignmentsRequest, - callback: PaginationCallback< - protos.google.cloud.bigquery.reservation.v1.ISearchAllAssignmentsRequest, - protos.google.cloud.bigquery.reservation.v1.ISearchAllAssignmentsResponse|null|undefined, - protos.google.cloud.bigquery.reservation.v1.IAssignment>): void; - searchAllAssignments( - request?: protos.google.cloud.bigquery.reservation.v1.ISearchAllAssignmentsRequest, - optionsOrCallback?: CallOptions|PaginationCallback< - protos.google.cloud.bigquery.reservation.v1.ISearchAllAssignmentsRequest, - protos.google.cloud.bigquery.reservation.v1.ISearchAllAssignmentsResponse|null|undefined, - protos.google.cloud.bigquery.reservation.v1.IAssignment>, - callback?: PaginationCallback< - protos.google.cloud.bigquery.reservation.v1.ISearchAllAssignmentsRequest, - protos.google.cloud.bigquery.reservation.v1.ISearchAllAssignmentsResponse|null|undefined, - protos.google.cloud.bigquery.reservation.v1.IAssignment>): - Promise<[ - protos.google.cloud.bigquery.reservation.v1.IAssignment[], - protos.google.cloud.bigquery.reservation.v1.ISearchAllAssignmentsRequest|null, - protos.google.cloud.bigquery.reservation.v1.ISearchAllAssignmentsResponse - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); - this.initialize(); - return this.innerApiCalls.searchAllAssignments(request, options, callback); - } - -/** - * Equivalent to `method.name.toCamelCase()`, but returns a NodeJS Stream object. - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The resource name with location (project name could be the - * wildcard '-'), e.g.: - * `projects/-/locations/US`. - * @param {string} request.query - * Please specify resource name as assignee in the query. - * - * Examples: - * - * * `assignee=projects/myproject` - * * `assignee=folders/123` - * * `assignee=organizations/456` - * @param {number} request.pageSize - * The maximum number of items to return per page. - * @param {string} request.pageToken - * The next_page_token value returned from a previous List request, if any. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Stream} - * An object stream which emits an object representing {@link google.cloud.bigquery.reservation.v1.Assignment | Assignment} on 'data' event. - * The client library will perform auto-pagination by default: it will call the API as many - * times as needed. Note that it can affect your quota. - * We recommend using `searchAllAssignmentsAsync()` - * method described below for async iteration which you can stop as needed. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) - * for more details and examples. - */ - searchAllAssignmentsStream( - request?: protos.google.cloud.bigquery.reservation.v1.ISearchAllAssignmentsRequest, - options?: CallOptions): - Transform{ - request = request || {}; - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); - const defaultCallSettings = this._defaults['searchAllAssignments']; - const callSettings = defaultCallSettings.merge(options); - this.initialize(); - return this.descriptors.page.searchAllAssignments.createStream( - this.innerApiCalls.searchAllAssignments as GaxCall, - request, - callSettings - ); - } - -/** - * Equivalent to `searchAllAssignments`, but returns an iterable object. - * - * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The resource name with location (project name could be the - * wildcard '-'), e.g.: - * `projects/-/locations/US`. - * @param {string} request.query - * Please specify resource name as assignee in the query. - * - * Examples: - * - * * `assignee=projects/myproject` - * * `assignee=folders/123` - * * `assignee=organizations/456` - * @param {number} request.pageSize - * The maximum number of items to return per page. - * @param {string} request.pageToken - * The next_page_token value returned from a previous List request, if any. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Object} - * An iterable Object that allows [async iteration](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols). - * When you iterate the returned iterable, each element will be an object representing - * {@link google.cloud.bigquery.reservation.v1.Assignment | Assignment}. The API will be called under the hood as needed, once per the page, - * so you can stop the iteration when you don't need more results. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) - * for more details and examples. - * @example include:samples/generated/v1/reservation_service.search_all_assignments.js - * region_tag:bigqueryreservation_v1_generated_ReservationService_SearchAllAssignments_async - */ - searchAllAssignmentsAsync( - request?: protos.google.cloud.bigquery.reservation.v1.ISearchAllAssignmentsRequest, - options?: CallOptions): - AsyncIterable{ - request = request || {}; - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); - const defaultCallSettings = this._defaults['searchAllAssignments']; - const callSettings = defaultCallSettings.merge(options); - this.initialize(); - return this.descriptors.page.searchAllAssignments.asyncIterate( - this.innerApiCalls['searchAllAssignments'] as GaxCall, - request as {}, - callSettings - ) as AsyncIterable; - } - // -------------------- - // -- Path templates -- - // -------------------- - - /** - * Return a fully-qualified assignment resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} reservation - * @param {string} assignment - * @returns {string} Resource name string. - */ - assignmentPath(project:string,location:string,reservation:string,assignment:string) { - return this.pathTemplates.assignmentPathTemplate.render({ - project: project, - location: location, - reservation: reservation, - assignment: assignment, - }); - } - - /** - * Parse the project from Assignment resource. - * - * @param {string} assignmentName - * A fully-qualified path representing Assignment resource. - * @returns {string} A string representing the project. - */ - matchProjectFromAssignmentName(assignmentName: string) { - return this.pathTemplates.assignmentPathTemplate.match(assignmentName).project; - } - - /** - * Parse the location from Assignment resource. - * - * @param {string} assignmentName - * A fully-qualified path representing Assignment resource. - * @returns {string} A string representing the location. - */ - matchLocationFromAssignmentName(assignmentName: string) { - return this.pathTemplates.assignmentPathTemplate.match(assignmentName).location; - } - - /** - * Parse the reservation from Assignment resource. - * - * @param {string} assignmentName - * A fully-qualified path representing Assignment resource. - * @returns {string} A string representing the reservation. - */ - matchReservationFromAssignmentName(assignmentName: string) { - return this.pathTemplates.assignmentPathTemplate.match(assignmentName).reservation; - } - - /** - * Parse the assignment from Assignment resource. - * - * @param {string} assignmentName - * A fully-qualified path representing Assignment resource. - * @returns {string} A string representing the assignment. - */ - matchAssignmentFromAssignmentName(assignmentName: string) { - return this.pathTemplates.assignmentPathTemplate.match(assignmentName).assignment; - } - - /** - * Return a fully-qualified biReservation resource name string. - * - * @param {string} project - * @param {string} location - * @returns {string} Resource name string. - */ - biReservationPath(project:string,location:string) { - return this.pathTemplates.biReservationPathTemplate.render({ - project: project, - location: location, - }); - } - - /** - * Parse the project from BiReservation resource. - * - * @param {string} biReservationName - * A fully-qualified path representing BiReservation resource. - * @returns {string} A string representing the project. - */ - matchProjectFromBiReservationName(biReservationName: string) { - return this.pathTemplates.biReservationPathTemplate.match(biReservationName).project; - } - - /** - * Parse the location from BiReservation resource. - * - * @param {string} biReservationName - * A fully-qualified path representing BiReservation resource. - * @returns {string} A string representing the location. - */ - matchLocationFromBiReservationName(biReservationName: string) { - return this.pathTemplates.biReservationPathTemplate.match(biReservationName).location; - } - - /** - * Return a fully-qualified capacityCommitment resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} capacity_commitment - * @returns {string} Resource name string. - */ - capacityCommitmentPath(project:string,location:string,capacityCommitment:string) { - return this.pathTemplates.capacityCommitmentPathTemplate.render({ - project: project, - location: location, - capacity_commitment: capacityCommitment, - }); - } - - /** - * Parse the project from CapacityCommitment resource. - * - * @param {string} capacityCommitmentName - * A fully-qualified path representing CapacityCommitment resource. - * @returns {string} A string representing the project. - */ - matchProjectFromCapacityCommitmentName(capacityCommitmentName: string) { - return this.pathTemplates.capacityCommitmentPathTemplate.match(capacityCommitmentName).project; - } - - /** - * Parse the location from CapacityCommitment resource. - * - * @param {string} capacityCommitmentName - * A fully-qualified path representing CapacityCommitment resource. - * @returns {string} A string representing the location. - */ - matchLocationFromCapacityCommitmentName(capacityCommitmentName: string) { - return this.pathTemplates.capacityCommitmentPathTemplate.match(capacityCommitmentName).location; - } - - /** - * Parse the capacity_commitment from CapacityCommitment resource. - * - * @param {string} capacityCommitmentName - * A fully-qualified path representing CapacityCommitment resource. - * @returns {string} A string representing the capacity_commitment. - */ - matchCapacityCommitmentFromCapacityCommitmentName(capacityCommitmentName: string) { - return this.pathTemplates.capacityCommitmentPathTemplate.match(capacityCommitmentName).capacity_commitment; - } - - /** - * Return a fully-qualified location resource name string. - * - * @param {string} project - * @param {string} location - * @returns {string} Resource name string. - */ - locationPath(project:string,location:string) { - return this.pathTemplates.locationPathTemplate.render({ - project: project, - location: location, - }); - } - - /** - * Parse the project from Location resource. - * - * @param {string} locationName - * A fully-qualified path representing Location resource. - * @returns {string} A string representing the project. - */ - matchProjectFromLocationName(locationName: string) { - return this.pathTemplates.locationPathTemplate.match(locationName).project; - } - - /** - * Parse the location from Location resource. - * - * @param {string} locationName - * A fully-qualified path representing Location resource. - * @returns {string} A string representing the location. - */ - matchLocationFromLocationName(locationName: string) { - return this.pathTemplates.locationPathTemplate.match(locationName).location; - } - - /** - * Return a fully-qualified project resource name string. - * - * @param {string} project - * @returns {string} Resource name string. - */ - projectPath(project:string) { - return this.pathTemplates.projectPathTemplate.render({ - project: project, - }); - } - - /** - * Parse the project from Project resource. - * - * @param {string} projectName - * A fully-qualified path representing Project resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectName(projectName: string) { - return this.pathTemplates.projectPathTemplate.match(projectName).project; - } - - /** - * Return a fully-qualified reservation resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} reservation - * @returns {string} Resource name string. - */ - reservationPath(project:string,location:string,reservation:string) { - return this.pathTemplates.reservationPathTemplate.render({ - project: project, - location: location, - reservation: reservation, - }); - } - - /** - * Parse the project from Reservation resource. - * - * @param {string} reservationName - * A fully-qualified path representing Reservation resource. - * @returns {string} A string representing the project. - */ - matchProjectFromReservationName(reservationName: string) { - return this.pathTemplates.reservationPathTemplate.match(reservationName).project; - } - - /** - * Parse the location from Reservation resource. - * - * @param {string} reservationName - * A fully-qualified path representing Reservation resource. - * @returns {string} A string representing the location. - */ - matchLocationFromReservationName(reservationName: string) { - return this.pathTemplates.reservationPathTemplate.match(reservationName).location; - } - - /** - * Parse the reservation from Reservation resource. - * - * @param {string} reservationName - * A fully-qualified path representing Reservation resource. - * @returns {string} A string representing the reservation. - */ - matchReservationFromReservationName(reservationName: string) { - return this.pathTemplates.reservationPathTemplate.match(reservationName).reservation; - } - - /** - * Terminate the gRPC channel and close the client. - * - * The client will no longer be usable and all future behavior is undefined. - * @returns {Promise} A promise that resolves when the client is closed. - */ - close(): Promise { - if (this.reservationServiceStub && !this._terminated) { - return this.reservationServiceStub.then(stub => { - this._terminated = true; - stub.close(); - }); - } - return Promise.resolve(); - } -} diff --git a/owl-bot-staging/google-cloud-bigquery-reservation/v1/src/v1/reservation_service_client_config.json b/owl-bot-staging/google-cloud-bigquery-reservation/v1/src/v1/reservation_service_client_config.json deleted file mode 100644 index 2ac442ba027..00000000000 --- a/owl-bot-staging/google-cloud-bigquery-reservation/v1/src/v1/reservation_service_client_config.json +++ /dev/null @@ -1,129 +0,0 @@ -{ - "interfaces": { - "google.cloud.bigquery.reservation.v1.ReservationService": { - "retry_codes": { - "non_idempotent": [], - "idempotent": [ - "DEADLINE_EXCEEDED", - "UNAVAILABLE" - ] - }, - "retry_params": { - "default": { - "initial_retry_delay_millis": 100, - "retry_delay_multiplier": 1.3, - "max_retry_delay_millis": 60000, - "initial_rpc_timeout_millis": 60000, - "rpc_timeout_multiplier": 1, - "max_rpc_timeout_millis": 60000, - "total_timeout_millis": 600000 - } - }, - "methods": { - "CreateReservation": { - "timeout_millis": 300000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "ListReservations": { - "timeout_millis": 300000, - "retry_codes_name": "idempotent", - "retry_params_name": "default" - }, - "GetReservation": { - "timeout_millis": 300000, - "retry_codes_name": "idempotent", - "retry_params_name": "default" - }, - "DeleteReservation": { - "timeout_millis": 300000, - "retry_codes_name": "idempotent", - "retry_params_name": "default" - }, - "UpdateReservation": { - "timeout_millis": 300000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "CreateCapacityCommitment": { - "timeout_millis": 300000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "ListCapacityCommitments": { - "timeout_millis": 300000, - "retry_codes_name": "idempotent", - "retry_params_name": "default" - }, - "GetCapacityCommitment": { - "timeout_millis": 300000, - "retry_codes_name": "idempotent", - "retry_params_name": "default" - }, - "DeleteCapacityCommitment": { - "timeout_millis": 300000, - "retry_codes_name": "idempotent", - "retry_params_name": "default" - }, - "UpdateCapacityCommitment": { - "timeout_millis": 300000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "SplitCapacityCommitment": { - "timeout_millis": 300000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "MergeCapacityCommitments": { - "timeout_millis": 300000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "CreateAssignment": { - "timeout_millis": 300000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "ListAssignments": { - "timeout_millis": 300000, - "retry_codes_name": "idempotent", - "retry_params_name": "default" - }, - "DeleteAssignment": { - "timeout_millis": 300000, - "retry_codes_name": "idempotent", - "retry_params_name": "default" - }, - "SearchAssignments": { - "timeout_millis": 300000, - "retry_codes_name": "idempotent", - "retry_params_name": "default" - }, - "SearchAllAssignments": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "MoveAssignment": { - "timeout_millis": 300000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "UpdateAssignment": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "GetBiReservation": { - "timeout_millis": 300000, - "retry_codes_name": "idempotent", - "retry_params_name": "default" - }, - "UpdateBiReservation": { - "timeout_millis": 300000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - } - } - } - } -} diff --git a/owl-bot-staging/google-cloud-bigquery-reservation/v1/src/v1/reservation_service_proto_list.json b/owl-bot-staging/google-cloud-bigquery-reservation/v1/src/v1/reservation_service_proto_list.json deleted file mode 100644 index 8746e8df5c9..00000000000 --- a/owl-bot-staging/google-cloud-bigquery-reservation/v1/src/v1/reservation_service_proto_list.json +++ /dev/null @@ -1,3 +0,0 @@ -[ - "../../protos/google/cloud/bigquery/reservation/v1/reservation.proto" -] diff --git a/owl-bot-staging/google-cloud-bigquery-reservation/v1/system-test/fixtures/sample/src/index.js b/owl-bot-staging/google-cloud-bigquery-reservation/v1/system-test/fixtures/sample/src/index.js deleted file mode 100644 index 7fe58ac561a..00000000000 --- a/owl-bot-staging/google-cloud-bigquery-reservation/v1/system-test/fixtures/sample/src/index.js +++ /dev/null @@ -1,27 +0,0 @@ -// Copyright 2023 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 -// -// https://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. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - - -/* eslint-disable node/no-missing-require, no-unused-vars */ -const reservation = require('@google-cloud/bigquery-reservation'); - -function main() { - const reservationServiceClient = new reservation.ReservationServiceClient(); -} - -main(); diff --git a/owl-bot-staging/google-cloud-bigquery-reservation/v1/system-test/fixtures/sample/src/index.ts b/owl-bot-staging/google-cloud-bigquery-reservation/v1/system-test/fixtures/sample/src/index.ts deleted file mode 100644 index fd3b2a70d20..00000000000 --- a/owl-bot-staging/google-cloud-bigquery-reservation/v1/system-test/fixtures/sample/src/index.ts +++ /dev/null @@ -1,32 +0,0 @@ -// Copyright 2023 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 -// -// https://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. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - -import {ReservationServiceClient} from '@google-cloud/bigquery-reservation'; - -// check that the client class type name can be used -function doStuffWithReservationServiceClient(client: ReservationServiceClient) { - client.close(); -} - -function main() { - // check that the client instance can be created - const reservationServiceClient = new ReservationServiceClient(); - doStuffWithReservationServiceClient(reservationServiceClient); -} - -main(); diff --git a/owl-bot-staging/google-cloud-bigquery-reservation/v1/system-test/install.ts b/owl-bot-staging/google-cloud-bigquery-reservation/v1/system-test/install.ts deleted file mode 100644 index c8f81b25a86..00000000000 --- a/owl-bot-staging/google-cloud-bigquery-reservation/v1/system-test/install.ts +++ /dev/null @@ -1,49 +0,0 @@ -// Copyright 2023 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 -// -// https://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. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - -import {packNTest} from 'pack-n-play'; -import {readFileSync} from 'fs'; -import {describe, it} from 'mocha'; - -describe('📦 pack-n-play test', () => { - - it('TypeScript code', async function() { - this.timeout(300000); - const options = { - packageDir: process.cwd(), - sample: { - description: 'TypeScript user can use the type definitions', - ts: readFileSync('./system-test/fixtures/sample/src/index.ts').toString() - } - }; - await packNTest(options); - }); - - it('JavaScript code', async function() { - this.timeout(300000); - const options = { - packageDir: process.cwd(), - sample: { - description: 'JavaScript user can use the library', - ts: readFileSync('./system-test/fixtures/sample/src/index.js').toString() - } - }; - await packNTest(options); - }); - -}); diff --git a/owl-bot-staging/google-cloud-bigquery-reservation/v1/test/gapic_reservation_service_v1.ts b/owl-bot-staging/google-cloud-bigquery-reservation/v1/test/gapic_reservation_service_v1.ts deleted file mode 100644 index 20dbf2a7e38..00000000000 --- a/owl-bot-staging/google-cloud-bigquery-reservation/v1/test/gapic_reservation_service_v1.ts +++ /dev/null @@ -1,3435 +0,0 @@ -// Copyright 2023 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 -// -// https://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. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - -import * as protos from '../protos/protos'; -import * as assert from 'assert'; -import * as sinon from 'sinon'; -import {SinonStub} from 'sinon'; -import {describe, it} from 'mocha'; -import * as reservationserviceModule from '../src'; - -import {PassThrough} from 'stream'; - -import {protobuf} from 'google-gax'; - -// Dynamically loaded proto JSON is needed to get the type information -// to fill in default values for request objects -const root = protobuf.Root.fromJSON(require('../protos/protos.json')).resolveAll(); - -// eslint-disable-next-line @typescript-eslint/no-unused-vars -function getTypeDefaultValue(typeName: string, fields: string[]) { - let type = root.lookupType(typeName) as protobuf.Type; - for (const field of fields.slice(0, -1)) { - type = type.fields[field]?.resolvedType as protobuf.Type; - } - return type.fields[fields[fields.length - 1]]?.defaultValue; -} - -function generateSampleMessage(instance: T) { - const filledObject = (instance.constructor as typeof protobuf.Message) - .toObject(instance as protobuf.Message, {defaults: true}); - return (instance.constructor as typeof protobuf.Message).fromObject(filledObject) as T; -} - -function stubSimpleCall(response?: ResponseType, error?: Error) { - return error ? sinon.stub().rejects(error) : sinon.stub().resolves([response]); -} - -function stubSimpleCallWithCallback(response?: ResponseType, error?: Error) { - return error ? sinon.stub().callsArgWith(2, error) : sinon.stub().callsArgWith(2, null, response); -} - -function stubPageStreamingCall(responses?: ResponseType[], error?: Error) { - const pagingStub = sinon.stub(); - if (responses) { - for (let i = 0; i < responses.length; ++i) { - pagingStub.onCall(i).callsArgWith(2, null, responses[i]); - } - } - const transformStub = error ? sinon.stub().callsArgWith(2, error) : pagingStub; - const mockStream = new PassThrough({ - objectMode: true, - transform: transformStub, - }); - // trigger as many responses as needed - if (responses) { - for (let i = 0; i < responses.length; ++i) { - setImmediate(() => { mockStream.write({}); }); - } - setImmediate(() => { mockStream.end(); }); - } else { - setImmediate(() => { mockStream.write({}); }); - setImmediate(() => { mockStream.end(); }); - } - return sinon.stub().returns(mockStream); -} - -function stubAsyncIterationCall(responses?: ResponseType[], error?: Error) { - let counter = 0; - const asyncIterable = { - [Symbol.asyncIterator]() { - return { - async next() { - if (error) { - return Promise.reject(error); - } - if (counter >= responses!.length) { - return Promise.resolve({done: true, value: undefined}); - } - return Promise.resolve({done: false, value: responses![counter++]}); - } - }; - } - }; - return sinon.stub().returns(asyncIterable); -} - -describe('v1.ReservationServiceClient', () => { - describe('Common methods', () => { - it('has servicePath', () => { - const servicePath = reservationserviceModule.v1.ReservationServiceClient.servicePath; - assert(servicePath); - }); - - it('has apiEndpoint', () => { - const apiEndpoint = reservationserviceModule.v1.ReservationServiceClient.apiEndpoint; - assert(apiEndpoint); - }); - - it('has port', () => { - const port = reservationserviceModule.v1.ReservationServiceClient.port; - assert(port); - assert(typeof port === 'number'); - }); - - it('should create a client with no option', () => { - const client = new reservationserviceModule.v1.ReservationServiceClient(); - assert(client); - }); - - it('should create a client with gRPC fallback', () => { - const client = new reservationserviceModule.v1.ReservationServiceClient({ - fallback: true, - }); - assert(client); - }); - - it('has initialize method and supports deferred initialization', async () => { - const client = new reservationserviceModule.v1.ReservationServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - assert.strictEqual(client.reservationServiceStub, undefined); - await client.initialize(); - assert(client.reservationServiceStub); - }); - - it('has close method for the initialized client', done => { - const client = new reservationserviceModule.v1.ReservationServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - assert(client.reservationServiceStub); - client.close().then(() => { - done(); - }); - }); - - it('has close method for the non-initialized client', done => { - const client = new reservationserviceModule.v1.ReservationServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - assert.strictEqual(client.reservationServiceStub, undefined); - client.close().then(() => { - done(); - }); - }); - - it('has getProjectId method', async () => { - const fakeProjectId = 'fake-project-id'; - const client = new reservationserviceModule.v1.ReservationServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.auth.getProjectId = sinon.stub().resolves(fakeProjectId); - const result = await client.getProjectId(); - assert.strictEqual(result, fakeProjectId); - assert((client.auth.getProjectId as SinonStub).calledWithExactly()); - }); - - it('has getProjectId method with callback', async () => { - const fakeProjectId = 'fake-project-id'; - const client = new reservationserviceModule.v1.ReservationServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.auth.getProjectId = sinon.stub().callsArgWith(0, null, fakeProjectId); - const promise = new Promise((resolve, reject) => { - client.getProjectId((err?: Error|null, projectId?: string|null) => { - if (err) { - reject(err); - } else { - resolve(projectId); - } - }); - }); - const result = await promise; - assert.strictEqual(result, fakeProjectId); - }); - }); - - describe('createReservation', () => { - it('invokes createReservation without error', async () => { - const client = new reservationserviceModule.v1.ReservationServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.bigquery.reservation.v1.CreateReservationRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.bigquery.reservation.v1.CreateReservationRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.bigquery.reservation.v1.Reservation() - ); - client.innerApiCalls.createReservation = stubSimpleCall(expectedResponse); - const [response] = await client.createReservation(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.createReservation as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createReservation as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createReservation without error using callback', async () => { - const client = new reservationserviceModule.v1.ReservationServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.bigquery.reservation.v1.CreateReservationRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.bigquery.reservation.v1.CreateReservationRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.bigquery.reservation.v1.Reservation() - ); - client.innerApiCalls.createReservation = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.createReservation( - request, - (err?: Error|null, result?: protos.google.cloud.bigquery.reservation.v1.IReservation|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.createReservation as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createReservation as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createReservation with error', async () => { - const client = new reservationserviceModule.v1.ReservationServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.bigquery.reservation.v1.CreateReservationRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.bigquery.reservation.v1.CreateReservationRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.createReservation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.createReservation(request), expectedError); - const actualRequest = (client.innerApiCalls.createReservation as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createReservation as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createReservation with closed client', async () => { - const client = new reservationserviceModule.v1.ReservationServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.bigquery.reservation.v1.CreateReservationRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.bigquery.reservation.v1.CreateReservationRequest', ['parent']); - request.parent = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.createReservation(request), expectedError); - }); - }); - - describe('getReservation', () => { - it('invokes getReservation without error', async () => { - const client = new reservationserviceModule.v1.ReservationServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.bigquery.reservation.v1.GetReservationRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.bigquery.reservation.v1.GetReservationRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.bigquery.reservation.v1.Reservation() - ); - client.innerApiCalls.getReservation = stubSimpleCall(expectedResponse); - const [response] = await client.getReservation(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getReservation as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getReservation as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getReservation without error using callback', async () => { - const client = new reservationserviceModule.v1.ReservationServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.bigquery.reservation.v1.GetReservationRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.bigquery.reservation.v1.GetReservationRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.bigquery.reservation.v1.Reservation() - ); - client.innerApiCalls.getReservation = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getReservation( - request, - (err?: Error|null, result?: protos.google.cloud.bigquery.reservation.v1.IReservation|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getReservation as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getReservation as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getReservation with error', async () => { - const client = new reservationserviceModule.v1.ReservationServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.bigquery.reservation.v1.GetReservationRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.bigquery.reservation.v1.GetReservationRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.getReservation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.getReservation(request), expectedError); - const actualRequest = (client.innerApiCalls.getReservation as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getReservation as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getReservation with closed client', async () => { - const client = new reservationserviceModule.v1.ReservationServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.bigquery.reservation.v1.GetReservationRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.bigquery.reservation.v1.GetReservationRequest', ['name']); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.getReservation(request), expectedError); - }); - }); - - describe('deleteReservation', () => { - it('invokes deleteReservation without error', async () => { - const client = new reservationserviceModule.v1.ReservationServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.bigquery.reservation.v1.DeleteReservationRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.bigquery.reservation.v1.DeleteReservationRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - client.innerApiCalls.deleteReservation = stubSimpleCall(expectedResponse); - const [response] = await client.deleteReservation(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.deleteReservation as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteReservation as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteReservation without error using callback', async () => { - const client = new reservationserviceModule.v1.ReservationServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.bigquery.reservation.v1.DeleteReservationRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.bigquery.reservation.v1.DeleteReservationRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - client.innerApiCalls.deleteReservation = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.deleteReservation( - request, - (err?: Error|null, result?: protos.google.protobuf.IEmpty|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.deleteReservation as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteReservation as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteReservation with error', async () => { - const client = new reservationserviceModule.v1.ReservationServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.bigquery.reservation.v1.DeleteReservationRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.bigquery.reservation.v1.DeleteReservationRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.deleteReservation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.deleteReservation(request), expectedError); - const actualRequest = (client.innerApiCalls.deleteReservation as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteReservation as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteReservation with closed client', async () => { - const client = new reservationserviceModule.v1.ReservationServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.bigquery.reservation.v1.DeleteReservationRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.bigquery.reservation.v1.DeleteReservationRequest', ['name']); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.deleteReservation(request), expectedError); - }); - }); - - describe('updateReservation', () => { - it('invokes updateReservation without error', async () => { - const client = new reservationserviceModule.v1.ReservationServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.bigquery.reservation.v1.UpdateReservationRequest() - ); - request.reservation ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.bigquery.reservation.v1.UpdateReservationRequest', ['reservation', 'name']); - request.reservation.name = defaultValue1; - const expectedHeaderRequestParams = `reservation.name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.bigquery.reservation.v1.Reservation() - ); - client.innerApiCalls.updateReservation = stubSimpleCall(expectedResponse); - const [response] = await client.updateReservation(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.updateReservation as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateReservation as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateReservation without error using callback', async () => { - const client = new reservationserviceModule.v1.ReservationServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.bigquery.reservation.v1.UpdateReservationRequest() - ); - request.reservation ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.bigquery.reservation.v1.UpdateReservationRequest', ['reservation', 'name']); - request.reservation.name = defaultValue1; - const expectedHeaderRequestParams = `reservation.name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.bigquery.reservation.v1.Reservation() - ); - client.innerApiCalls.updateReservation = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.updateReservation( - request, - (err?: Error|null, result?: protos.google.cloud.bigquery.reservation.v1.IReservation|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.updateReservation as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateReservation as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateReservation with error', async () => { - const client = new reservationserviceModule.v1.ReservationServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.bigquery.reservation.v1.UpdateReservationRequest() - ); - request.reservation ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.bigquery.reservation.v1.UpdateReservationRequest', ['reservation', 'name']); - request.reservation.name = defaultValue1; - const expectedHeaderRequestParams = `reservation.name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.updateReservation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.updateReservation(request), expectedError); - const actualRequest = (client.innerApiCalls.updateReservation as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateReservation as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateReservation with closed client', async () => { - const client = new reservationserviceModule.v1.ReservationServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.bigquery.reservation.v1.UpdateReservationRequest() - ); - request.reservation ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.bigquery.reservation.v1.UpdateReservationRequest', ['reservation', 'name']); - request.reservation.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.updateReservation(request), expectedError); - }); - }); - - describe('createCapacityCommitment', () => { - it('invokes createCapacityCommitment without error', async () => { - const client = new reservationserviceModule.v1.ReservationServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.bigquery.reservation.v1.CreateCapacityCommitmentRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.bigquery.reservation.v1.CreateCapacityCommitmentRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.bigquery.reservation.v1.CapacityCommitment() - ); - client.innerApiCalls.createCapacityCommitment = stubSimpleCall(expectedResponse); - const [response] = await client.createCapacityCommitment(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.createCapacityCommitment as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createCapacityCommitment as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createCapacityCommitment without error using callback', async () => { - const client = new reservationserviceModule.v1.ReservationServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.bigquery.reservation.v1.CreateCapacityCommitmentRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.bigquery.reservation.v1.CreateCapacityCommitmentRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.bigquery.reservation.v1.CapacityCommitment() - ); - client.innerApiCalls.createCapacityCommitment = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.createCapacityCommitment( - request, - (err?: Error|null, result?: protos.google.cloud.bigquery.reservation.v1.ICapacityCommitment|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.createCapacityCommitment as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createCapacityCommitment as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createCapacityCommitment with error', async () => { - const client = new reservationserviceModule.v1.ReservationServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.bigquery.reservation.v1.CreateCapacityCommitmentRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.bigquery.reservation.v1.CreateCapacityCommitmentRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.createCapacityCommitment = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.createCapacityCommitment(request), expectedError); - const actualRequest = (client.innerApiCalls.createCapacityCommitment as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createCapacityCommitment as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createCapacityCommitment with closed client', async () => { - const client = new reservationserviceModule.v1.ReservationServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.bigquery.reservation.v1.CreateCapacityCommitmentRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.bigquery.reservation.v1.CreateCapacityCommitmentRequest', ['parent']); - request.parent = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.createCapacityCommitment(request), expectedError); - }); - }); - - describe('getCapacityCommitment', () => { - it('invokes getCapacityCommitment without error', async () => { - const client = new reservationserviceModule.v1.ReservationServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.bigquery.reservation.v1.GetCapacityCommitmentRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.bigquery.reservation.v1.GetCapacityCommitmentRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.bigquery.reservation.v1.CapacityCommitment() - ); - client.innerApiCalls.getCapacityCommitment = stubSimpleCall(expectedResponse); - const [response] = await client.getCapacityCommitment(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getCapacityCommitment as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getCapacityCommitment as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getCapacityCommitment without error using callback', async () => { - const client = new reservationserviceModule.v1.ReservationServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.bigquery.reservation.v1.GetCapacityCommitmentRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.bigquery.reservation.v1.GetCapacityCommitmentRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.bigquery.reservation.v1.CapacityCommitment() - ); - client.innerApiCalls.getCapacityCommitment = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getCapacityCommitment( - request, - (err?: Error|null, result?: protos.google.cloud.bigquery.reservation.v1.ICapacityCommitment|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getCapacityCommitment as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getCapacityCommitment as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getCapacityCommitment with error', async () => { - const client = new reservationserviceModule.v1.ReservationServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.bigquery.reservation.v1.GetCapacityCommitmentRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.bigquery.reservation.v1.GetCapacityCommitmentRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.getCapacityCommitment = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.getCapacityCommitment(request), expectedError); - const actualRequest = (client.innerApiCalls.getCapacityCommitment as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getCapacityCommitment as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getCapacityCommitment with closed client', async () => { - const client = new reservationserviceModule.v1.ReservationServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.bigquery.reservation.v1.GetCapacityCommitmentRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.bigquery.reservation.v1.GetCapacityCommitmentRequest', ['name']); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.getCapacityCommitment(request), expectedError); - }); - }); - - describe('deleteCapacityCommitment', () => { - it('invokes deleteCapacityCommitment without error', async () => { - const client = new reservationserviceModule.v1.ReservationServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.bigquery.reservation.v1.DeleteCapacityCommitmentRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.bigquery.reservation.v1.DeleteCapacityCommitmentRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - client.innerApiCalls.deleteCapacityCommitment = stubSimpleCall(expectedResponse); - const [response] = await client.deleteCapacityCommitment(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.deleteCapacityCommitment as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteCapacityCommitment as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteCapacityCommitment without error using callback', async () => { - const client = new reservationserviceModule.v1.ReservationServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.bigquery.reservation.v1.DeleteCapacityCommitmentRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.bigquery.reservation.v1.DeleteCapacityCommitmentRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - client.innerApiCalls.deleteCapacityCommitment = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.deleteCapacityCommitment( - request, - (err?: Error|null, result?: protos.google.protobuf.IEmpty|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.deleteCapacityCommitment as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteCapacityCommitment as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteCapacityCommitment with error', async () => { - const client = new reservationserviceModule.v1.ReservationServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.bigquery.reservation.v1.DeleteCapacityCommitmentRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.bigquery.reservation.v1.DeleteCapacityCommitmentRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.deleteCapacityCommitment = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.deleteCapacityCommitment(request), expectedError); - const actualRequest = (client.innerApiCalls.deleteCapacityCommitment as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteCapacityCommitment as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteCapacityCommitment with closed client', async () => { - const client = new reservationserviceModule.v1.ReservationServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.bigquery.reservation.v1.DeleteCapacityCommitmentRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.bigquery.reservation.v1.DeleteCapacityCommitmentRequest', ['name']); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.deleteCapacityCommitment(request), expectedError); - }); - }); - - describe('updateCapacityCommitment', () => { - it('invokes updateCapacityCommitment without error', async () => { - const client = new reservationserviceModule.v1.ReservationServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.bigquery.reservation.v1.UpdateCapacityCommitmentRequest() - ); - request.capacityCommitment ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.bigquery.reservation.v1.UpdateCapacityCommitmentRequest', ['capacityCommitment', 'name']); - request.capacityCommitment.name = defaultValue1; - const expectedHeaderRequestParams = `capacity_commitment.name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.bigquery.reservation.v1.CapacityCommitment() - ); - client.innerApiCalls.updateCapacityCommitment = stubSimpleCall(expectedResponse); - const [response] = await client.updateCapacityCommitment(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.updateCapacityCommitment as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateCapacityCommitment as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateCapacityCommitment without error using callback', async () => { - const client = new reservationserviceModule.v1.ReservationServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.bigquery.reservation.v1.UpdateCapacityCommitmentRequest() - ); - request.capacityCommitment ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.bigquery.reservation.v1.UpdateCapacityCommitmentRequest', ['capacityCommitment', 'name']); - request.capacityCommitment.name = defaultValue1; - const expectedHeaderRequestParams = `capacity_commitment.name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.bigquery.reservation.v1.CapacityCommitment() - ); - client.innerApiCalls.updateCapacityCommitment = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.updateCapacityCommitment( - request, - (err?: Error|null, result?: protos.google.cloud.bigquery.reservation.v1.ICapacityCommitment|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.updateCapacityCommitment as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateCapacityCommitment as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateCapacityCommitment with error', async () => { - const client = new reservationserviceModule.v1.ReservationServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.bigquery.reservation.v1.UpdateCapacityCommitmentRequest() - ); - request.capacityCommitment ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.bigquery.reservation.v1.UpdateCapacityCommitmentRequest', ['capacityCommitment', 'name']); - request.capacityCommitment.name = defaultValue1; - const expectedHeaderRequestParams = `capacity_commitment.name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.updateCapacityCommitment = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.updateCapacityCommitment(request), expectedError); - const actualRequest = (client.innerApiCalls.updateCapacityCommitment as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateCapacityCommitment as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateCapacityCommitment with closed client', async () => { - const client = new reservationserviceModule.v1.ReservationServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.bigquery.reservation.v1.UpdateCapacityCommitmentRequest() - ); - request.capacityCommitment ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.bigquery.reservation.v1.UpdateCapacityCommitmentRequest', ['capacityCommitment', 'name']); - request.capacityCommitment.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.updateCapacityCommitment(request), expectedError); - }); - }); - - describe('splitCapacityCommitment', () => { - it('invokes splitCapacityCommitment without error', async () => { - const client = new reservationserviceModule.v1.ReservationServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.bigquery.reservation.v1.SplitCapacityCommitmentRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.bigquery.reservation.v1.SplitCapacityCommitmentRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.bigquery.reservation.v1.SplitCapacityCommitmentResponse() - ); - client.innerApiCalls.splitCapacityCommitment = stubSimpleCall(expectedResponse); - const [response] = await client.splitCapacityCommitment(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.splitCapacityCommitment as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.splitCapacityCommitment as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes splitCapacityCommitment without error using callback', async () => { - const client = new reservationserviceModule.v1.ReservationServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.bigquery.reservation.v1.SplitCapacityCommitmentRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.bigquery.reservation.v1.SplitCapacityCommitmentRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.bigquery.reservation.v1.SplitCapacityCommitmentResponse() - ); - client.innerApiCalls.splitCapacityCommitment = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.splitCapacityCommitment( - request, - (err?: Error|null, result?: protos.google.cloud.bigquery.reservation.v1.ISplitCapacityCommitmentResponse|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.splitCapacityCommitment as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.splitCapacityCommitment as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes splitCapacityCommitment with error', async () => { - const client = new reservationserviceModule.v1.ReservationServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.bigquery.reservation.v1.SplitCapacityCommitmentRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.bigquery.reservation.v1.SplitCapacityCommitmentRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.splitCapacityCommitment = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.splitCapacityCommitment(request), expectedError); - const actualRequest = (client.innerApiCalls.splitCapacityCommitment as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.splitCapacityCommitment as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes splitCapacityCommitment with closed client', async () => { - const client = new reservationserviceModule.v1.ReservationServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.bigquery.reservation.v1.SplitCapacityCommitmentRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.bigquery.reservation.v1.SplitCapacityCommitmentRequest', ['name']); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.splitCapacityCommitment(request), expectedError); - }); - }); - - describe('mergeCapacityCommitments', () => { - it('invokes mergeCapacityCommitments without error', async () => { - const client = new reservationserviceModule.v1.ReservationServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.bigquery.reservation.v1.MergeCapacityCommitmentsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.bigquery.reservation.v1.MergeCapacityCommitmentsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.bigquery.reservation.v1.CapacityCommitment() - ); - client.innerApiCalls.mergeCapacityCommitments = stubSimpleCall(expectedResponse); - const [response] = await client.mergeCapacityCommitments(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.mergeCapacityCommitments as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.mergeCapacityCommitments as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes mergeCapacityCommitments without error using callback', async () => { - const client = new reservationserviceModule.v1.ReservationServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.bigquery.reservation.v1.MergeCapacityCommitmentsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.bigquery.reservation.v1.MergeCapacityCommitmentsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.bigquery.reservation.v1.CapacityCommitment() - ); - client.innerApiCalls.mergeCapacityCommitments = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.mergeCapacityCommitments( - request, - (err?: Error|null, result?: protos.google.cloud.bigquery.reservation.v1.ICapacityCommitment|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.mergeCapacityCommitments as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.mergeCapacityCommitments as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes mergeCapacityCommitments with error', async () => { - const client = new reservationserviceModule.v1.ReservationServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.bigquery.reservation.v1.MergeCapacityCommitmentsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.bigquery.reservation.v1.MergeCapacityCommitmentsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.mergeCapacityCommitments = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.mergeCapacityCommitments(request), expectedError); - const actualRequest = (client.innerApiCalls.mergeCapacityCommitments as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.mergeCapacityCommitments as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes mergeCapacityCommitments with closed client', async () => { - const client = new reservationserviceModule.v1.ReservationServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.bigquery.reservation.v1.MergeCapacityCommitmentsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.bigquery.reservation.v1.MergeCapacityCommitmentsRequest', ['parent']); - request.parent = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.mergeCapacityCommitments(request), expectedError); - }); - }); - - describe('createAssignment', () => { - it('invokes createAssignment without error', async () => { - const client = new reservationserviceModule.v1.ReservationServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.bigquery.reservation.v1.CreateAssignmentRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.bigquery.reservation.v1.CreateAssignmentRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.bigquery.reservation.v1.Assignment() - ); - client.innerApiCalls.createAssignment = stubSimpleCall(expectedResponse); - const [response] = await client.createAssignment(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.createAssignment as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createAssignment as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createAssignment without error using callback', async () => { - const client = new reservationserviceModule.v1.ReservationServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.bigquery.reservation.v1.CreateAssignmentRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.bigquery.reservation.v1.CreateAssignmentRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.bigquery.reservation.v1.Assignment() - ); - client.innerApiCalls.createAssignment = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.createAssignment( - request, - (err?: Error|null, result?: protos.google.cloud.bigquery.reservation.v1.IAssignment|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.createAssignment as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createAssignment as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createAssignment with error', async () => { - const client = new reservationserviceModule.v1.ReservationServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.bigquery.reservation.v1.CreateAssignmentRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.bigquery.reservation.v1.CreateAssignmentRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.createAssignment = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.createAssignment(request), expectedError); - const actualRequest = (client.innerApiCalls.createAssignment as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createAssignment as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createAssignment with closed client', async () => { - const client = new reservationserviceModule.v1.ReservationServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.bigquery.reservation.v1.CreateAssignmentRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.bigquery.reservation.v1.CreateAssignmentRequest', ['parent']); - request.parent = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.createAssignment(request), expectedError); - }); - }); - - describe('deleteAssignment', () => { - it('invokes deleteAssignment without error', async () => { - const client = new reservationserviceModule.v1.ReservationServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.bigquery.reservation.v1.DeleteAssignmentRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.bigquery.reservation.v1.DeleteAssignmentRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - client.innerApiCalls.deleteAssignment = stubSimpleCall(expectedResponse); - const [response] = await client.deleteAssignment(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.deleteAssignment as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteAssignment as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteAssignment without error using callback', async () => { - const client = new reservationserviceModule.v1.ReservationServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.bigquery.reservation.v1.DeleteAssignmentRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.bigquery.reservation.v1.DeleteAssignmentRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - client.innerApiCalls.deleteAssignment = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.deleteAssignment( - request, - (err?: Error|null, result?: protos.google.protobuf.IEmpty|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.deleteAssignment as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteAssignment as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteAssignment with error', async () => { - const client = new reservationserviceModule.v1.ReservationServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.bigquery.reservation.v1.DeleteAssignmentRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.bigquery.reservation.v1.DeleteAssignmentRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.deleteAssignment = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.deleteAssignment(request), expectedError); - const actualRequest = (client.innerApiCalls.deleteAssignment as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteAssignment as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteAssignment with closed client', async () => { - const client = new reservationserviceModule.v1.ReservationServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.bigquery.reservation.v1.DeleteAssignmentRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.bigquery.reservation.v1.DeleteAssignmentRequest', ['name']); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.deleteAssignment(request), expectedError); - }); - }); - - describe('moveAssignment', () => { - it('invokes moveAssignment without error', async () => { - const client = new reservationserviceModule.v1.ReservationServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.bigquery.reservation.v1.MoveAssignmentRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.bigquery.reservation.v1.MoveAssignmentRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.bigquery.reservation.v1.Assignment() - ); - client.innerApiCalls.moveAssignment = stubSimpleCall(expectedResponse); - const [response] = await client.moveAssignment(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.moveAssignment as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.moveAssignment as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes moveAssignment without error using callback', async () => { - const client = new reservationserviceModule.v1.ReservationServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.bigquery.reservation.v1.MoveAssignmentRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.bigquery.reservation.v1.MoveAssignmentRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.bigquery.reservation.v1.Assignment() - ); - client.innerApiCalls.moveAssignment = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.moveAssignment( - request, - (err?: Error|null, result?: protos.google.cloud.bigquery.reservation.v1.IAssignment|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.moveAssignment as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.moveAssignment as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes moveAssignment with error', async () => { - const client = new reservationserviceModule.v1.ReservationServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.bigquery.reservation.v1.MoveAssignmentRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.bigquery.reservation.v1.MoveAssignmentRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.moveAssignment = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.moveAssignment(request), expectedError); - const actualRequest = (client.innerApiCalls.moveAssignment as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.moveAssignment as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes moveAssignment with closed client', async () => { - const client = new reservationserviceModule.v1.ReservationServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.bigquery.reservation.v1.MoveAssignmentRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.bigquery.reservation.v1.MoveAssignmentRequest', ['name']); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.moveAssignment(request), expectedError); - }); - }); - - describe('updateAssignment', () => { - it('invokes updateAssignment without error', async () => { - const client = new reservationserviceModule.v1.ReservationServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.bigquery.reservation.v1.UpdateAssignmentRequest() - ); - request.assignment ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.bigquery.reservation.v1.UpdateAssignmentRequest', ['assignment', 'name']); - request.assignment.name = defaultValue1; - const expectedHeaderRequestParams = `assignment.name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.bigquery.reservation.v1.Assignment() - ); - client.innerApiCalls.updateAssignment = stubSimpleCall(expectedResponse); - const [response] = await client.updateAssignment(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.updateAssignment as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateAssignment as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateAssignment without error using callback', async () => { - const client = new reservationserviceModule.v1.ReservationServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.bigquery.reservation.v1.UpdateAssignmentRequest() - ); - request.assignment ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.bigquery.reservation.v1.UpdateAssignmentRequest', ['assignment', 'name']); - request.assignment.name = defaultValue1; - const expectedHeaderRequestParams = `assignment.name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.bigquery.reservation.v1.Assignment() - ); - client.innerApiCalls.updateAssignment = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.updateAssignment( - request, - (err?: Error|null, result?: protos.google.cloud.bigquery.reservation.v1.IAssignment|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.updateAssignment as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateAssignment as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateAssignment with error', async () => { - const client = new reservationserviceModule.v1.ReservationServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.bigquery.reservation.v1.UpdateAssignmentRequest() - ); - request.assignment ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.bigquery.reservation.v1.UpdateAssignmentRequest', ['assignment', 'name']); - request.assignment.name = defaultValue1; - const expectedHeaderRequestParams = `assignment.name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.updateAssignment = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.updateAssignment(request), expectedError); - const actualRequest = (client.innerApiCalls.updateAssignment as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateAssignment as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateAssignment with closed client', async () => { - const client = new reservationserviceModule.v1.ReservationServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.bigquery.reservation.v1.UpdateAssignmentRequest() - ); - request.assignment ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.bigquery.reservation.v1.UpdateAssignmentRequest', ['assignment', 'name']); - request.assignment.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.updateAssignment(request), expectedError); - }); - }); - - describe('getBiReservation', () => { - it('invokes getBiReservation without error', async () => { - const client = new reservationserviceModule.v1.ReservationServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.bigquery.reservation.v1.GetBiReservationRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.bigquery.reservation.v1.GetBiReservationRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.bigquery.reservation.v1.BiReservation() - ); - client.innerApiCalls.getBiReservation = stubSimpleCall(expectedResponse); - const [response] = await client.getBiReservation(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getBiReservation as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getBiReservation as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getBiReservation without error using callback', async () => { - const client = new reservationserviceModule.v1.ReservationServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.bigquery.reservation.v1.GetBiReservationRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.bigquery.reservation.v1.GetBiReservationRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.bigquery.reservation.v1.BiReservation() - ); - client.innerApiCalls.getBiReservation = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getBiReservation( - request, - (err?: Error|null, result?: protos.google.cloud.bigquery.reservation.v1.IBiReservation|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getBiReservation as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getBiReservation as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getBiReservation with error', async () => { - const client = new reservationserviceModule.v1.ReservationServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.bigquery.reservation.v1.GetBiReservationRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.bigquery.reservation.v1.GetBiReservationRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.getBiReservation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.getBiReservation(request), expectedError); - const actualRequest = (client.innerApiCalls.getBiReservation as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getBiReservation as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getBiReservation with closed client', async () => { - const client = new reservationserviceModule.v1.ReservationServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.bigquery.reservation.v1.GetBiReservationRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.bigquery.reservation.v1.GetBiReservationRequest', ['name']); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.getBiReservation(request), expectedError); - }); - }); - - describe('updateBiReservation', () => { - it('invokes updateBiReservation without error', async () => { - const client = new reservationserviceModule.v1.ReservationServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.bigquery.reservation.v1.UpdateBiReservationRequest() - ); - request.biReservation ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.bigquery.reservation.v1.UpdateBiReservationRequest', ['biReservation', 'name']); - request.biReservation.name = defaultValue1; - const expectedHeaderRequestParams = `bi_reservation.name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.bigquery.reservation.v1.BiReservation() - ); - client.innerApiCalls.updateBiReservation = stubSimpleCall(expectedResponse); - const [response] = await client.updateBiReservation(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.updateBiReservation as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateBiReservation as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateBiReservation without error using callback', async () => { - const client = new reservationserviceModule.v1.ReservationServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.bigquery.reservation.v1.UpdateBiReservationRequest() - ); - request.biReservation ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.bigquery.reservation.v1.UpdateBiReservationRequest', ['biReservation', 'name']); - request.biReservation.name = defaultValue1; - const expectedHeaderRequestParams = `bi_reservation.name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.bigquery.reservation.v1.BiReservation() - ); - client.innerApiCalls.updateBiReservation = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.updateBiReservation( - request, - (err?: Error|null, result?: protos.google.cloud.bigquery.reservation.v1.IBiReservation|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.updateBiReservation as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateBiReservation as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateBiReservation with error', async () => { - const client = new reservationserviceModule.v1.ReservationServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.bigquery.reservation.v1.UpdateBiReservationRequest() - ); - request.biReservation ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.bigquery.reservation.v1.UpdateBiReservationRequest', ['biReservation', 'name']); - request.biReservation.name = defaultValue1; - const expectedHeaderRequestParams = `bi_reservation.name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.updateBiReservation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.updateBiReservation(request), expectedError); - const actualRequest = (client.innerApiCalls.updateBiReservation as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateBiReservation as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateBiReservation with closed client', async () => { - const client = new reservationserviceModule.v1.ReservationServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.bigquery.reservation.v1.UpdateBiReservationRequest() - ); - request.biReservation ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.bigquery.reservation.v1.UpdateBiReservationRequest', ['biReservation', 'name']); - request.biReservation.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.updateBiReservation(request), expectedError); - }); - }); - - describe('listReservations', () => { - it('invokes listReservations without error', async () => { - const client = new reservationserviceModule.v1.ReservationServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.bigquery.reservation.v1.ListReservationsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.bigquery.reservation.v1.ListReservationsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.bigquery.reservation.v1.Reservation()), - generateSampleMessage(new protos.google.cloud.bigquery.reservation.v1.Reservation()), - generateSampleMessage(new protos.google.cloud.bigquery.reservation.v1.Reservation()), - ]; - client.innerApiCalls.listReservations = stubSimpleCall(expectedResponse); - const [response] = await client.listReservations(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listReservations as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listReservations as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listReservations without error using callback', async () => { - const client = new reservationserviceModule.v1.ReservationServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.bigquery.reservation.v1.ListReservationsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.bigquery.reservation.v1.ListReservationsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.bigquery.reservation.v1.Reservation()), - generateSampleMessage(new protos.google.cloud.bigquery.reservation.v1.Reservation()), - generateSampleMessage(new protos.google.cloud.bigquery.reservation.v1.Reservation()), - ]; - client.innerApiCalls.listReservations = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.listReservations( - request, - (err?: Error|null, result?: protos.google.cloud.bigquery.reservation.v1.IReservation[]|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listReservations as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listReservations as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listReservations with error', async () => { - const client = new reservationserviceModule.v1.ReservationServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.bigquery.reservation.v1.ListReservationsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.bigquery.reservation.v1.ListReservationsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.listReservations = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.listReservations(request), expectedError); - const actualRequest = (client.innerApiCalls.listReservations as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listReservations as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listReservationsStream without error', async () => { - const client = new reservationserviceModule.v1.ReservationServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.bigquery.reservation.v1.ListReservationsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.bigquery.reservation.v1.ListReservationsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.bigquery.reservation.v1.Reservation()), - generateSampleMessage(new protos.google.cloud.bigquery.reservation.v1.Reservation()), - generateSampleMessage(new protos.google.cloud.bigquery.reservation.v1.Reservation()), - ]; - client.descriptors.page.listReservations.createStream = stubPageStreamingCall(expectedResponse); - const stream = client.listReservationsStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.bigquery.reservation.v1.Reservation[] = []; - stream.on('data', (response: protos.google.cloud.bigquery.reservation.v1.Reservation) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - const responses = await promise; - assert.deepStrictEqual(responses, expectedResponse); - assert((client.descriptors.page.listReservations.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listReservations, request)); - assert( - (client.descriptors.page.listReservations.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('invokes listReservationsStream with error', async () => { - const client = new reservationserviceModule.v1.ReservationServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.bigquery.reservation.v1.ListReservationsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.bigquery.reservation.v1.ListReservationsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.descriptors.page.listReservations.createStream = stubPageStreamingCall(undefined, expectedError); - const stream = client.listReservationsStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.bigquery.reservation.v1.Reservation[] = []; - stream.on('data', (response: protos.google.cloud.bigquery.reservation.v1.Reservation) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - await assert.rejects(promise, expectedError); - assert((client.descriptors.page.listReservations.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listReservations, request)); - assert( - (client.descriptors.page.listReservations.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with listReservations without error', async () => { - const client = new reservationserviceModule.v1.ReservationServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.bigquery.reservation.v1.ListReservationsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.bigquery.reservation.v1.ListReservationsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.bigquery.reservation.v1.Reservation()), - generateSampleMessage(new protos.google.cloud.bigquery.reservation.v1.Reservation()), - generateSampleMessage(new protos.google.cloud.bigquery.reservation.v1.Reservation()), - ]; - client.descriptors.page.listReservations.asyncIterate = stubAsyncIterationCall(expectedResponse); - const responses: protos.google.cloud.bigquery.reservation.v1.IReservation[] = []; - const iterable = client.listReservationsAsync(request); - for await (const resource of iterable) { - responses.push(resource!); - } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - (client.descriptors.page.listReservations.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listReservations.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with listReservations with error', async () => { - const client = new reservationserviceModule.v1.ReservationServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.bigquery.reservation.v1.ListReservationsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.bigquery.reservation.v1.ListReservationsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.descriptors.page.listReservations.asyncIterate = stubAsyncIterationCall(undefined, expectedError); - const iterable = client.listReservationsAsync(request); - await assert.rejects(async () => { - const responses: protos.google.cloud.bigquery.reservation.v1.IReservation[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - (client.descriptors.page.listReservations.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listReservations.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - }); - - describe('listCapacityCommitments', () => { - it('invokes listCapacityCommitments without error', async () => { - const client = new reservationserviceModule.v1.ReservationServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.bigquery.reservation.v1.ListCapacityCommitmentsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.bigquery.reservation.v1.ListCapacityCommitmentsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.bigquery.reservation.v1.CapacityCommitment()), - generateSampleMessage(new protos.google.cloud.bigquery.reservation.v1.CapacityCommitment()), - generateSampleMessage(new protos.google.cloud.bigquery.reservation.v1.CapacityCommitment()), - ]; - client.innerApiCalls.listCapacityCommitments = stubSimpleCall(expectedResponse); - const [response] = await client.listCapacityCommitments(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listCapacityCommitments as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listCapacityCommitments as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listCapacityCommitments without error using callback', async () => { - const client = new reservationserviceModule.v1.ReservationServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.bigquery.reservation.v1.ListCapacityCommitmentsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.bigquery.reservation.v1.ListCapacityCommitmentsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.bigquery.reservation.v1.CapacityCommitment()), - generateSampleMessage(new protos.google.cloud.bigquery.reservation.v1.CapacityCommitment()), - generateSampleMessage(new protos.google.cloud.bigquery.reservation.v1.CapacityCommitment()), - ]; - client.innerApiCalls.listCapacityCommitments = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.listCapacityCommitments( - request, - (err?: Error|null, result?: protos.google.cloud.bigquery.reservation.v1.ICapacityCommitment[]|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listCapacityCommitments as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listCapacityCommitments as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listCapacityCommitments with error', async () => { - const client = new reservationserviceModule.v1.ReservationServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.bigquery.reservation.v1.ListCapacityCommitmentsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.bigquery.reservation.v1.ListCapacityCommitmentsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.listCapacityCommitments = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.listCapacityCommitments(request), expectedError); - const actualRequest = (client.innerApiCalls.listCapacityCommitments as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listCapacityCommitments as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listCapacityCommitmentsStream without error', async () => { - const client = new reservationserviceModule.v1.ReservationServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.bigquery.reservation.v1.ListCapacityCommitmentsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.bigquery.reservation.v1.ListCapacityCommitmentsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.bigquery.reservation.v1.CapacityCommitment()), - generateSampleMessage(new protos.google.cloud.bigquery.reservation.v1.CapacityCommitment()), - generateSampleMessage(new protos.google.cloud.bigquery.reservation.v1.CapacityCommitment()), - ]; - client.descriptors.page.listCapacityCommitments.createStream = stubPageStreamingCall(expectedResponse); - const stream = client.listCapacityCommitmentsStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.bigquery.reservation.v1.CapacityCommitment[] = []; - stream.on('data', (response: protos.google.cloud.bigquery.reservation.v1.CapacityCommitment) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - const responses = await promise; - assert.deepStrictEqual(responses, expectedResponse); - assert((client.descriptors.page.listCapacityCommitments.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listCapacityCommitments, request)); - assert( - (client.descriptors.page.listCapacityCommitments.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('invokes listCapacityCommitmentsStream with error', async () => { - const client = new reservationserviceModule.v1.ReservationServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.bigquery.reservation.v1.ListCapacityCommitmentsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.bigquery.reservation.v1.ListCapacityCommitmentsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.descriptors.page.listCapacityCommitments.createStream = stubPageStreamingCall(undefined, expectedError); - const stream = client.listCapacityCommitmentsStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.bigquery.reservation.v1.CapacityCommitment[] = []; - stream.on('data', (response: protos.google.cloud.bigquery.reservation.v1.CapacityCommitment) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - await assert.rejects(promise, expectedError); - assert((client.descriptors.page.listCapacityCommitments.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listCapacityCommitments, request)); - assert( - (client.descriptors.page.listCapacityCommitments.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with listCapacityCommitments without error', async () => { - const client = new reservationserviceModule.v1.ReservationServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.bigquery.reservation.v1.ListCapacityCommitmentsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.bigquery.reservation.v1.ListCapacityCommitmentsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.bigquery.reservation.v1.CapacityCommitment()), - generateSampleMessage(new protos.google.cloud.bigquery.reservation.v1.CapacityCommitment()), - generateSampleMessage(new protos.google.cloud.bigquery.reservation.v1.CapacityCommitment()), - ]; - client.descriptors.page.listCapacityCommitments.asyncIterate = stubAsyncIterationCall(expectedResponse); - const responses: protos.google.cloud.bigquery.reservation.v1.ICapacityCommitment[] = []; - const iterable = client.listCapacityCommitmentsAsync(request); - for await (const resource of iterable) { - responses.push(resource!); - } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - (client.descriptors.page.listCapacityCommitments.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listCapacityCommitments.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with listCapacityCommitments with error', async () => { - const client = new reservationserviceModule.v1.ReservationServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.bigquery.reservation.v1.ListCapacityCommitmentsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.bigquery.reservation.v1.ListCapacityCommitmentsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.descriptors.page.listCapacityCommitments.asyncIterate = stubAsyncIterationCall(undefined, expectedError); - const iterable = client.listCapacityCommitmentsAsync(request); - await assert.rejects(async () => { - const responses: protos.google.cloud.bigquery.reservation.v1.ICapacityCommitment[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - (client.descriptors.page.listCapacityCommitments.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listCapacityCommitments.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - }); - - describe('listAssignments', () => { - it('invokes listAssignments without error', async () => { - const client = new reservationserviceModule.v1.ReservationServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.bigquery.reservation.v1.ListAssignmentsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.bigquery.reservation.v1.ListAssignmentsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.bigquery.reservation.v1.Assignment()), - generateSampleMessage(new protos.google.cloud.bigquery.reservation.v1.Assignment()), - generateSampleMessage(new protos.google.cloud.bigquery.reservation.v1.Assignment()), - ]; - client.innerApiCalls.listAssignments = stubSimpleCall(expectedResponse); - const [response] = await client.listAssignments(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listAssignments as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listAssignments as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listAssignments without error using callback', async () => { - const client = new reservationserviceModule.v1.ReservationServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.bigquery.reservation.v1.ListAssignmentsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.bigquery.reservation.v1.ListAssignmentsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.bigquery.reservation.v1.Assignment()), - generateSampleMessage(new protos.google.cloud.bigquery.reservation.v1.Assignment()), - generateSampleMessage(new protos.google.cloud.bigquery.reservation.v1.Assignment()), - ]; - client.innerApiCalls.listAssignments = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.listAssignments( - request, - (err?: Error|null, result?: protos.google.cloud.bigquery.reservation.v1.IAssignment[]|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listAssignments as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listAssignments as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listAssignments with error', async () => { - const client = new reservationserviceModule.v1.ReservationServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.bigquery.reservation.v1.ListAssignmentsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.bigquery.reservation.v1.ListAssignmentsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.listAssignments = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.listAssignments(request), expectedError); - const actualRequest = (client.innerApiCalls.listAssignments as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listAssignments as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listAssignmentsStream without error', async () => { - const client = new reservationserviceModule.v1.ReservationServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.bigquery.reservation.v1.ListAssignmentsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.bigquery.reservation.v1.ListAssignmentsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.bigquery.reservation.v1.Assignment()), - generateSampleMessage(new protos.google.cloud.bigquery.reservation.v1.Assignment()), - generateSampleMessage(new protos.google.cloud.bigquery.reservation.v1.Assignment()), - ]; - client.descriptors.page.listAssignments.createStream = stubPageStreamingCall(expectedResponse); - const stream = client.listAssignmentsStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.bigquery.reservation.v1.Assignment[] = []; - stream.on('data', (response: protos.google.cloud.bigquery.reservation.v1.Assignment) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - const responses = await promise; - assert.deepStrictEqual(responses, expectedResponse); - assert((client.descriptors.page.listAssignments.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listAssignments, request)); - assert( - (client.descriptors.page.listAssignments.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('invokes listAssignmentsStream with error', async () => { - const client = new reservationserviceModule.v1.ReservationServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.bigquery.reservation.v1.ListAssignmentsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.bigquery.reservation.v1.ListAssignmentsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.descriptors.page.listAssignments.createStream = stubPageStreamingCall(undefined, expectedError); - const stream = client.listAssignmentsStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.bigquery.reservation.v1.Assignment[] = []; - stream.on('data', (response: protos.google.cloud.bigquery.reservation.v1.Assignment) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - await assert.rejects(promise, expectedError); - assert((client.descriptors.page.listAssignments.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listAssignments, request)); - assert( - (client.descriptors.page.listAssignments.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with listAssignments without error', async () => { - const client = new reservationserviceModule.v1.ReservationServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.bigquery.reservation.v1.ListAssignmentsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.bigquery.reservation.v1.ListAssignmentsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.bigquery.reservation.v1.Assignment()), - generateSampleMessage(new protos.google.cloud.bigquery.reservation.v1.Assignment()), - generateSampleMessage(new protos.google.cloud.bigquery.reservation.v1.Assignment()), - ]; - client.descriptors.page.listAssignments.asyncIterate = stubAsyncIterationCall(expectedResponse); - const responses: protos.google.cloud.bigquery.reservation.v1.IAssignment[] = []; - const iterable = client.listAssignmentsAsync(request); - for await (const resource of iterable) { - responses.push(resource!); - } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - (client.descriptors.page.listAssignments.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listAssignments.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with listAssignments with error', async () => { - const client = new reservationserviceModule.v1.ReservationServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.bigquery.reservation.v1.ListAssignmentsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.bigquery.reservation.v1.ListAssignmentsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.descriptors.page.listAssignments.asyncIterate = stubAsyncIterationCall(undefined, expectedError); - const iterable = client.listAssignmentsAsync(request); - await assert.rejects(async () => { - const responses: protos.google.cloud.bigquery.reservation.v1.IAssignment[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - (client.descriptors.page.listAssignments.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listAssignments.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - }); - - describe('searchAssignments', () => { - it('invokes searchAssignments without error', async () => { - const client = new reservationserviceModule.v1.ReservationServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - const stub = sinon.stub(client, 'warn'); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.bigquery.reservation.v1.SearchAssignmentsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.bigquery.reservation.v1.SearchAssignmentsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.bigquery.reservation.v1.Assignment()), - generateSampleMessage(new protos.google.cloud.bigquery.reservation.v1.Assignment()), - generateSampleMessage(new protos.google.cloud.bigquery.reservation.v1.Assignment()), - ]; - client.innerApiCalls.searchAssignments = stubSimpleCall(expectedResponse); - const [response] = await client.searchAssignments(request); - assert(stub.calledOnce); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.searchAssignments as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.searchAssignments as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes searchAssignments without error using callback', async () => { - const client = new reservationserviceModule.v1.ReservationServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - const stub = sinon.stub(client, 'warn'); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.bigquery.reservation.v1.SearchAssignmentsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.bigquery.reservation.v1.SearchAssignmentsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.bigquery.reservation.v1.Assignment()), - generateSampleMessage(new protos.google.cloud.bigquery.reservation.v1.Assignment()), - generateSampleMessage(new protos.google.cloud.bigquery.reservation.v1.Assignment()), - ]; - client.innerApiCalls.searchAssignments = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.searchAssignments( - request, - (err?: Error|null, result?: protos.google.cloud.bigquery.reservation.v1.IAssignment[]|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert(stub.calledOnce); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.searchAssignments as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.searchAssignments as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes searchAssignments with error', async () => { - const client = new reservationserviceModule.v1.ReservationServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - const stub = sinon.stub(client, 'warn'); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.bigquery.reservation.v1.SearchAssignmentsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.bigquery.reservation.v1.SearchAssignmentsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.searchAssignments = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.searchAssignments(request), expectedError); - assert(stub.calledOnce); - const actualRequest = (client.innerApiCalls.searchAssignments as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.searchAssignments as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes searchAssignmentsStream without error', async () => { - const client = new reservationserviceModule.v1.ReservationServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - const stub = sinon.stub(client, 'warn'); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.bigquery.reservation.v1.SearchAssignmentsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.bigquery.reservation.v1.SearchAssignmentsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.bigquery.reservation.v1.Assignment()), - generateSampleMessage(new protos.google.cloud.bigquery.reservation.v1.Assignment()), - generateSampleMessage(new protos.google.cloud.bigquery.reservation.v1.Assignment()), - ]; - client.descriptors.page.searchAssignments.createStream = stubPageStreamingCall(expectedResponse); - const stream = client.searchAssignmentsStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.bigquery.reservation.v1.Assignment[] = []; - stream.on('data', (response: protos.google.cloud.bigquery.reservation.v1.Assignment) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - const responses = await promise; - assert(stub.calledOnce); - assert.deepStrictEqual(responses, expectedResponse); - assert((client.descriptors.page.searchAssignments.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.searchAssignments, request)); - assert( - (client.descriptors.page.searchAssignments.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('invokes searchAssignmentsStream with error', async () => { - const client = new reservationserviceModule.v1.ReservationServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - const stub = sinon.stub(client, 'warn'); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.bigquery.reservation.v1.SearchAssignmentsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.bigquery.reservation.v1.SearchAssignmentsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.descriptors.page.searchAssignments.createStream = stubPageStreamingCall(undefined, expectedError); - const stream = client.searchAssignmentsStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.bigquery.reservation.v1.Assignment[] = []; - stream.on('data', (response: protos.google.cloud.bigquery.reservation.v1.Assignment) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - await assert.rejects(promise, expectedError); - assert(stub.calledOnce); - assert((client.descriptors.page.searchAssignments.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.searchAssignments, request)); - assert( - (client.descriptors.page.searchAssignments.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with searchAssignments without error', async () => { - const client = new reservationserviceModule.v1.ReservationServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - const stub = sinon.stub(client, 'warn'); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.bigquery.reservation.v1.SearchAssignmentsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.bigquery.reservation.v1.SearchAssignmentsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.bigquery.reservation.v1.Assignment()), - generateSampleMessage(new protos.google.cloud.bigquery.reservation.v1.Assignment()), - generateSampleMessage(new protos.google.cloud.bigquery.reservation.v1.Assignment()), - ]; - client.descriptors.page.searchAssignments.asyncIterate = stubAsyncIterationCall(expectedResponse); - const responses: protos.google.cloud.bigquery.reservation.v1.IAssignment[] = []; - const iterable = client.searchAssignmentsAsync(request); - for await (const resource of iterable) { - responses.push(resource!); - } - assert(stub.calledOnce); - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - (client.descriptors.page.searchAssignments.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.searchAssignments.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with searchAssignments with error', async () => { - const client = new reservationserviceModule.v1.ReservationServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - const stub = sinon.stub(client, 'warn'); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.bigquery.reservation.v1.SearchAssignmentsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.bigquery.reservation.v1.SearchAssignmentsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.descriptors.page.searchAssignments.asyncIterate = stubAsyncIterationCall(undefined, expectedError); - const iterable = client.searchAssignmentsAsync(request); - await assert.rejects(async () => { - const responses: protos.google.cloud.bigquery.reservation.v1.IAssignment[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert(stub.calledOnce); - assert.deepStrictEqual( - (client.descriptors.page.searchAssignments.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.searchAssignments.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - }); - - describe('searchAllAssignments', () => { - it('invokes searchAllAssignments without error', async () => { - const client = new reservationserviceModule.v1.ReservationServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.bigquery.reservation.v1.SearchAllAssignmentsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.bigquery.reservation.v1.SearchAllAssignmentsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.bigquery.reservation.v1.Assignment()), - generateSampleMessage(new protos.google.cloud.bigquery.reservation.v1.Assignment()), - generateSampleMessage(new protos.google.cloud.bigquery.reservation.v1.Assignment()), - ]; - client.innerApiCalls.searchAllAssignments = stubSimpleCall(expectedResponse); - const [response] = await client.searchAllAssignments(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.searchAllAssignments as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.searchAllAssignments as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes searchAllAssignments without error using callback', async () => { - const client = new reservationserviceModule.v1.ReservationServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.bigquery.reservation.v1.SearchAllAssignmentsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.bigquery.reservation.v1.SearchAllAssignmentsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.bigquery.reservation.v1.Assignment()), - generateSampleMessage(new protos.google.cloud.bigquery.reservation.v1.Assignment()), - generateSampleMessage(new protos.google.cloud.bigquery.reservation.v1.Assignment()), - ]; - client.innerApiCalls.searchAllAssignments = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.searchAllAssignments( - request, - (err?: Error|null, result?: protos.google.cloud.bigquery.reservation.v1.IAssignment[]|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.searchAllAssignments as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.searchAllAssignments as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes searchAllAssignments with error', async () => { - const client = new reservationserviceModule.v1.ReservationServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.bigquery.reservation.v1.SearchAllAssignmentsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.bigquery.reservation.v1.SearchAllAssignmentsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.searchAllAssignments = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.searchAllAssignments(request), expectedError); - const actualRequest = (client.innerApiCalls.searchAllAssignments as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.searchAllAssignments as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes searchAllAssignmentsStream without error', async () => { - const client = new reservationserviceModule.v1.ReservationServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.bigquery.reservation.v1.SearchAllAssignmentsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.bigquery.reservation.v1.SearchAllAssignmentsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.bigquery.reservation.v1.Assignment()), - generateSampleMessage(new protos.google.cloud.bigquery.reservation.v1.Assignment()), - generateSampleMessage(new protos.google.cloud.bigquery.reservation.v1.Assignment()), - ]; - client.descriptors.page.searchAllAssignments.createStream = stubPageStreamingCall(expectedResponse); - const stream = client.searchAllAssignmentsStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.bigquery.reservation.v1.Assignment[] = []; - stream.on('data', (response: protos.google.cloud.bigquery.reservation.v1.Assignment) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - const responses = await promise; - assert.deepStrictEqual(responses, expectedResponse); - assert((client.descriptors.page.searchAllAssignments.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.searchAllAssignments, request)); - assert( - (client.descriptors.page.searchAllAssignments.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('invokes searchAllAssignmentsStream with error', async () => { - const client = new reservationserviceModule.v1.ReservationServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.bigquery.reservation.v1.SearchAllAssignmentsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.bigquery.reservation.v1.SearchAllAssignmentsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.descriptors.page.searchAllAssignments.createStream = stubPageStreamingCall(undefined, expectedError); - const stream = client.searchAllAssignmentsStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.bigquery.reservation.v1.Assignment[] = []; - stream.on('data', (response: protos.google.cloud.bigquery.reservation.v1.Assignment) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - await assert.rejects(promise, expectedError); - assert((client.descriptors.page.searchAllAssignments.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.searchAllAssignments, request)); - assert( - (client.descriptors.page.searchAllAssignments.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with searchAllAssignments without error', async () => { - const client = new reservationserviceModule.v1.ReservationServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.bigquery.reservation.v1.SearchAllAssignmentsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.bigquery.reservation.v1.SearchAllAssignmentsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.bigquery.reservation.v1.Assignment()), - generateSampleMessage(new protos.google.cloud.bigquery.reservation.v1.Assignment()), - generateSampleMessage(new protos.google.cloud.bigquery.reservation.v1.Assignment()), - ]; - client.descriptors.page.searchAllAssignments.asyncIterate = stubAsyncIterationCall(expectedResponse); - const responses: protos.google.cloud.bigquery.reservation.v1.IAssignment[] = []; - const iterable = client.searchAllAssignmentsAsync(request); - for await (const resource of iterable) { - responses.push(resource!); - } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - (client.descriptors.page.searchAllAssignments.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.searchAllAssignments.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with searchAllAssignments with error', async () => { - const client = new reservationserviceModule.v1.ReservationServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.bigquery.reservation.v1.SearchAllAssignmentsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.bigquery.reservation.v1.SearchAllAssignmentsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.descriptors.page.searchAllAssignments.asyncIterate = stubAsyncIterationCall(undefined, expectedError); - const iterable = client.searchAllAssignmentsAsync(request); - await assert.rejects(async () => { - const responses: protos.google.cloud.bigquery.reservation.v1.IAssignment[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - (client.descriptors.page.searchAllAssignments.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.searchAllAssignments.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - }); - - describe('Path templates', () => { - - describe('assignment', () => { - const fakePath = "/rendered/path/assignment"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - reservation: "reservationValue", - assignment: "assignmentValue", - }; - const client = new reservationserviceModule.v1.ReservationServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.assignmentPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.assignmentPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('assignmentPath', () => { - const result = client.assignmentPath("projectValue", "locationValue", "reservationValue", "assignmentValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.assignmentPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromAssignmentName', () => { - const result = client.matchProjectFromAssignmentName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.assignmentPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromAssignmentName', () => { - const result = client.matchLocationFromAssignmentName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.assignmentPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchReservationFromAssignmentName', () => { - const result = client.matchReservationFromAssignmentName(fakePath); - assert.strictEqual(result, "reservationValue"); - assert((client.pathTemplates.assignmentPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchAssignmentFromAssignmentName', () => { - const result = client.matchAssignmentFromAssignmentName(fakePath); - assert.strictEqual(result, "assignmentValue"); - assert((client.pathTemplates.assignmentPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('biReservation', () => { - const fakePath = "/rendered/path/biReservation"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - }; - const client = new reservationserviceModule.v1.ReservationServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.biReservationPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.biReservationPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('biReservationPath', () => { - const result = client.biReservationPath("projectValue", "locationValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.biReservationPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromBiReservationName', () => { - const result = client.matchProjectFromBiReservationName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.biReservationPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromBiReservationName', () => { - const result = client.matchLocationFromBiReservationName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.biReservationPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('capacityCommitment', () => { - const fakePath = "/rendered/path/capacityCommitment"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - capacity_commitment: "capacityCommitmentValue", - }; - const client = new reservationserviceModule.v1.ReservationServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.capacityCommitmentPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.capacityCommitmentPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('capacityCommitmentPath', () => { - const result = client.capacityCommitmentPath("projectValue", "locationValue", "capacityCommitmentValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.capacityCommitmentPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromCapacityCommitmentName', () => { - const result = client.matchProjectFromCapacityCommitmentName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.capacityCommitmentPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromCapacityCommitmentName', () => { - const result = client.matchLocationFromCapacityCommitmentName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.capacityCommitmentPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchCapacityCommitmentFromCapacityCommitmentName', () => { - const result = client.matchCapacityCommitmentFromCapacityCommitmentName(fakePath); - assert.strictEqual(result, "capacityCommitmentValue"); - assert((client.pathTemplates.capacityCommitmentPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('location', () => { - const fakePath = "/rendered/path/location"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - }; - const client = new reservationserviceModule.v1.ReservationServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.locationPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.locationPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('locationPath', () => { - const result = client.locationPath("projectValue", "locationValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.locationPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromLocationName', () => { - const result = client.matchProjectFromLocationName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.locationPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromLocationName', () => { - const result = client.matchLocationFromLocationName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.locationPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('project', () => { - const fakePath = "/rendered/path/project"; - const expectedParameters = { - project: "projectValue", - }; - const client = new reservationserviceModule.v1.ReservationServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectPath', () => { - const result = client.projectPath("projectValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectName', () => { - const result = client.matchProjectFromProjectName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('reservation', () => { - const fakePath = "/rendered/path/reservation"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - reservation: "reservationValue", - }; - const client = new reservationserviceModule.v1.ReservationServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.reservationPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.reservationPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('reservationPath', () => { - const result = client.reservationPath("projectValue", "locationValue", "reservationValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.reservationPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromReservationName', () => { - const result = client.matchProjectFromReservationName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.reservationPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromReservationName', () => { - const result = client.matchLocationFromReservationName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.reservationPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchReservationFromReservationName', () => { - const result = client.matchReservationFromReservationName(fakePath); - assert.strictEqual(result, "reservationValue"); - assert((client.pathTemplates.reservationPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - }); -}); diff --git a/owl-bot-staging/google-cloud-bigquery-reservation/v1/tsconfig.json b/owl-bot-staging/google-cloud-bigquery-reservation/v1/tsconfig.json deleted file mode 100644 index c78f1c884ef..00000000000 --- a/owl-bot-staging/google-cloud-bigquery-reservation/v1/tsconfig.json +++ /dev/null @@ -1,19 +0,0 @@ -{ - "extends": "./node_modules/gts/tsconfig-google.json", - "compilerOptions": { - "rootDir": ".", - "outDir": "build", - "resolveJsonModule": true, - "lib": [ - "es2018", - "dom" - ] - }, - "include": [ - "src/*.ts", - "src/**/*.ts", - "test/*.ts", - "test/**/*.ts", - "system-test/*.ts" - ] -} diff --git a/owl-bot-staging/google-cloud-bigquery-reservation/v1/webpack.config.js b/owl-bot-staging/google-cloud-bigquery-reservation/v1/webpack.config.js deleted file mode 100644 index bf29b0f5297..00000000000 --- a/owl-bot-staging/google-cloud-bigquery-reservation/v1/webpack.config.js +++ /dev/null @@ -1,64 +0,0 @@ -// 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 -// -// https://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. - -const path = require('path'); - -module.exports = { - entry: './src/index.ts', - output: { - library: 'ReservationService', - filename: './reservation-service.js', - }, - node: { - child_process: 'empty', - fs: 'empty', - crypto: 'empty', - }, - resolve: { - alias: { - '../../../package.json': path.resolve(__dirname, 'package.json'), - }, - extensions: ['.js', '.json', '.ts'], - }, - module: { - rules: [ - { - test: /\.tsx?$/, - use: 'ts-loader', - exclude: /node_modules/ - }, - { - test: /node_modules[\\/]@grpc[\\/]grpc-js/, - use: 'null-loader' - }, - { - test: /node_modules[\\/]grpc/, - use: 'null-loader' - }, - { - test: /node_modules[\\/]retry-request/, - use: 'null-loader' - }, - { - test: /node_modules[\\/]https?-proxy-agent/, - use: 'null-loader' - }, - { - test: /node_modules[\\/]gtoken/, - use: 'null-loader' - }, - ], - }, - mode: 'production', -}; diff --git a/packages/google-cloud-bigquery-reservation/protos/google/cloud/bigquery/reservation/v1/reservation.proto b/packages/google-cloud-bigquery-reservation/protos/google/cloud/bigquery/reservation/v1/reservation.proto index 013095ef3cd..6be4b70a0e1 100644 --- a/packages/google-cloud-bigquery-reservation/protos/google/cloud/bigquery/reservation/v1/reservation.proto +++ b/packages/google-cloud-bigquery-reservation/protos/google/cloud/bigquery/reservation/v1/reservation.proto @@ -1,4 +1,4 @@ -// Copyright 2022 Google LLC +// Copyright 2023 Google LLC // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. @@ -63,7 +63,8 @@ service ReservationService { } // Lists all the reservations for the project in the specified location. - rpc ListReservations(ListReservationsRequest) returns (ListReservationsResponse) { + rpc ListReservations(ListReservationsRequest) + returns (ListReservationsResponse) { option (google.api.http) = { get: "/v1/{parent=projects/*/locations/*}/reservations" }; @@ -81,7 +82,8 @@ service ReservationService { // Deletes a reservation. // Returns `google.rpc.Code.FAILED_PRECONDITION` when reservation has // assignments. - rpc DeleteReservation(DeleteReservationRequest) returns (google.protobuf.Empty) { + rpc DeleteReservation(DeleteReservationRequest) + returns (google.protobuf.Empty) { option (google.api.http) = { delete: "/v1/{name=projects/*/locations/*/reservations/*}" }; @@ -98,7 +100,8 @@ service ReservationService { } // Creates a new capacity commitment resource. - rpc CreateCapacityCommitment(CreateCapacityCommitmentRequest) returns (CapacityCommitment) { + rpc CreateCapacityCommitment(CreateCapacityCommitmentRequest) + returns (CapacityCommitment) { option (google.api.http) = { post: "/v1/{parent=projects/*/locations/*}/capacityCommitments" body: "capacity_commitment" @@ -107,7 +110,8 @@ service ReservationService { } // Lists all the capacity commitments for the admin project. - rpc ListCapacityCommitments(ListCapacityCommitmentsRequest) returns (ListCapacityCommitmentsResponse) { + rpc ListCapacityCommitments(ListCapacityCommitmentsRequest) + returns (ListCapacityCommitmentsResponse) { option (google.api.http) = { get: "/v1/{parent=projects/*/locations/*}/capacityCommitments" }; @@ -115,7 +119,8 @@ service ReservationService { } // Returns information about the capacity commitment. - rpc GetCapacityCommitment(GetCapacityCommitmentRequest) returns (CapacityCommitment) { + rpc GetCapacityCommitment(GetCapacityCommitmentRequest) + returns (CapacityCommitment) { option (google.api.http) = { get: "/v1/{name=projects/*/locations/*/capacityCommitments/*}" }; @@ -125,7 +130,8 @@ service ReservationService { // Deletes a capacity commitment. Attempting to delete capacity commitment // before its commitment_end_time will fail with the error code // `google.rpc.Code.FAILED_PRECONDITION`. - rpc DeleteCapacityCommitment(DeleteCapacityCommitmentRequest) returns (google.protobuf.Empty) { + rpc DeleteCapacityCommitment(DeleteCapacityCommitmentRequest) + returns (google.protobuf.Empty) { option (google.api.http) = { delete: "/v1/{name=projects/*/locations/*/capacityCommitments/*}" }; @@ -139,7 +145,8 @@ service ReservationService { // Plan can only be changed to a plan of a longer commitment period. // Attempting to change to a plan with shorter commitment period will fail // with the error code `google.rpc.Code.FAILED_PRECONDITION`. - rpc UpdateCapacityCommitment(UpdateCapacityCommitmentRequest) returns (CapacityCommitment) { + rpc UpdateCapacityCommitment(UpdateCapacityCommitmentRequest) + returns (CapacityCommitment) { option (google.api.http) = { patch: "/v1/{capacity_commitment.name=projects/*/locations/*/capacityCommitments/*}" body: "capacity_commitment" @@ -155,7 +162,8 @@ service ReservationService { // For example, in order to downgrade from 10000 slots to 8000, you might // split a 10000 capacity commitment into commitments of 2000 and 8000. Then, // you delete the first one after the commitment end time passes. - rpc SplitCapacityCommitment(SplitCapacityCommitmentRequest) returns (SplitCapacityCommitmentResponse) { + rpc SplitCapacityCommitment(SplitCapacityCommitmentRequest) + returns (SplitCapacityCommitmentResponse) { option (google.api.http) = { post: "/v1/{name=projects/*/locations/*/capacityCommitments/*}:split" body: "*" @@ -170,7 +178,8 @@ service ReservationService { // // Attempting to merge capacity commitments of different plan will fail // with the error code `google.rpc.Code.FAILED_PRECONDITION`. - rpc MergeCapacityCommitments(MergeCapacityCommitmentsRequest) returns (CapacityCommitment) { + rpc MergeCapacityCommitments(MergeCapacityCommitmentsRequest) + returns (CapacityCommitment) { option (google.api.http) = { post: "/v1/{parent=projects/*/locations/*}/capacityCommitments:merge" body: "*" @@ -242,7 +251,8 @@ service ReservationService { // specified project and location will be listed. // // **Note** "-" cannot be used for projects nor locations. - rpc ListAssignments(ListAssignmentsRequest) returns (ListAssignmentsResponse) { + rpc ListAssignments(ListAssignmentsRequest) + returns (ListAssignmentsResponse) { option (google.api.http) = { get: "/v1/{parent=projects/*/locations/*/reservations/*}/assignments" }; @@ -264,7 +274,8 @@ service ReservationService { // affect the other assignment ``. After said deletion, // queries from `project1` will still use `res1` while queries from // `project2` will switch to use on-demand mode. - rpc DeleteAssignment(DeleteAssignmentRequest) returns (google.protobuf.Empty) { + rpc DeleteAssignment(DeleteAssignmentRequest) + returns (google.protobuf.Empty) { option (google.api.http) = { delete: "/v1/{name=projects/*/locations/*/reservations/*/assignments/*}" }; @@ -294,7 +305,8 @@ service ReservationService { // // **Note** "-" cannot be used for projects // nor locations. - rpc SearchAssignments(SearchAssignmentsRequest) returns (SearchAssignmentsResponse) { + rpc SearchAssignments(SearchAssignmentsRequest) + returns (SearchAssignmentsResponse) { option deprecated = true; option (google.api.http) = { get: "/v1/{parent=projects/*/locations/*}:searchAssignments" @@ -322,7 +334,8 @@ service ReservationService { // 2. Hierarchy lookup (project->folder->organization) happens in this API. // 3. Parent here is `projects/*/locations/*`, instead of // `projects/*/locations/*reservations/*`. - rpc SearchAllAssignments(SearchAllAssignmentsRequest) returns (SearchAllAssignmentsResponse) { + rpc SearchAllAssignments(SearchAllAssignmentsRequest) + returns (SearchAllAssignmentsResponse) { option (google.api.http) = { get: "/v1/{parent=projects/*/locations/*}:searchAllAssignments" }; @@ -385,6 +398,16 @@ message Reservation { pattern: "projects/{project}/locations/{location}/reservations/{reservation}" }; + // Auto scaling settings. + message Autoscale { + // Output only. The slot capacity added to this reservation when autoscale + // happens. Will be between [0, max_slots]. + int64 current_slots = 1 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Number of slots to be scaled when needed. + int64 max_slots = 2; + } + // The resource name of the reservation, e.g., // `projects/*/locations/*/reservations/team1-prod`. // The reservation_id must only contain lower case alphanumeric characters or @@ -398,10 +421,10 @@ message Reservation { // Queries using this reservation might use more slots during runtime if // ignore_idle_slots is set to false. // - // If the new reservation's slot capacity exceeds the project's slot capacity - // or if total slot capacity of the new reservation and its siblings exceeds - // the project's slot capacity, the request will fail with - // `google.rpc.Code.RESOURCE_EXHAUSTED`. + // If total slot_capacity of the reservation and its siblings + // exceeds the total slot_count of all capacity commitments, the request will + // fail with `google.rpc.Code.RESOURCE_EXHAUSTED`. + // // // NOTE: for reservations in US or EU multi-regions, slot capacity constraints // are checked separately for default and auxiliary regions. See @@ -414,18 +437,27 @@ message Reservation { // capacity specified in the slot_capacity field at most. bool ignore_idle_slots = 4; - // Maximum number of queries that are allowed to run concurrently in this - // reservation. This is a soft limit due to asynchronous nature of the system - // and various optimizations for small queries. - // Default value is 0 which means that concurrency will be automatically set - // based on the reservation size. + // The configuration parameters for the auto scaling feature. Note this is an + // alpha feature. + Autoscale autoscale = 7; + + // Job concurrency target which sets a soft upper bound on the number of jobs + // that can run concurrently in this reservation. This is a soft target due to + // asynchronous nature of the system and various optimizations for small + // queries. + // Default value is 0 which means that concurrency target will be + // automatically computed by the system. + // NOTE: this field is exposed as `target_job_concurrency` in the Information + // Schema, DDL and BQ CLI. int64 concurrency = 16; // Output only. Creation time of the reservation. - google.protobuf.Timestamp creation_time = 8 [(google.api.field_behavior) = OUTPUT_ONLY]; + google.protobuf.Timestamp creation_time = 8 + [(google.api.field_behavior) = OUTPUT_ONLY]; // Output only. Last update time of the reservation. - google.protobuf.Timestamp update_time = 9 [(google.api.field_behavior) = OUTPUT_ONLY]; + google.protobuf.Timestamp update_time = 9 + [(google.api.field_behavior) = OUTPUT_ONLY]; // Applicable only for reservations located within one of the BigQuery // multi-regions (US or EU). @@ -434,6 +466,9 @@ message Reservation { // secondary region which is designated for disaster recovery purposes. // If false, this reservation is placed in the organization's default region. bool multi_region_auxiliary = 14; + + // Edition of the reservation. + Edition edition = 17; } // Capacity commitment is a way to purchase compute capacity for BigQuery jobs @@ -464,6 +499,10 @@ message CapacityCommitment { // any time. FLEX = 3; + // Same as FLEX, should only be used if flat-rate commitments are still + // available. + FLEX_FLAT_RATE = 7; + // Trial commitments have a committed period of 182 days after becoming // ACTIVE. After that, they are converted to a new commitment based on the // `renewal_plan`. Default `renewal_plan` for Trial commitment is Flex so @@ -475,10 +514,31 @@ message CapacityCommitment { // removed any time. MONTHLY = 2; + // Same as MONTHLY, should only be used if flat-rate commitments are still + // available. + MONTHLY_FLAT_RATE = 8; + // Annual commitments have a committed period of 365 days after becoming // ACTIVE. After that they are converted to a new commitment based on the // renewal_plan. ANNUAL = 4; + + // Same as ANNUAL, should only be used if flat-rate commitments are still + // available. + ANNUAL_FLAT_RATE = 9; + + // 3-year commitments have a committed period of 1095(3 * 365) days after + // becoming ACTIVE. After that they are converted to a new commitment based + // on the renewal_plan. + THREE_YEAR = 10; + + // Should only be used for `renewal_plan` and is only meaningful if + // edition is specified to values other than EDITION_UNSPECIFIED. Otherwise + // CreateCapacityCommitmentRequest or UpdateCapacityCommitmentRequest will + // be rejected with error code `google.rpc.Code.INVALID_ARGUMENT`. If the + // renewal_plan is NONE, capacity commitment will be removed at the end of + // its commitment period. + NONE = 6; } // Capacity commitment can either become ACTIVE right away or transition @@ -515,16 +575,19 @@ message CapacityCommitment { // Output only. State of the commitment. State state = 4 [(google.api.field_behavior) = OUTPUT_ONLY]; - // Output only. The start of the current commitment period. It is applicable only for - // ACTIVE capacity commitments. - google.protobuf.Timestamp commitment_start_time = 9 [(google.api.field_behavior) = OUTPUT_ONLY]; + // Output only. The start of the current commitment period. It is applicable + // only for ACTIVE capacity commitments. + google.protobuf.Timestamp commitment_start_time = 9 + [(google.api.field_behavior) = OUTPUT_ONLY]; - // Output only. The end of the current commitment period. It is applicable only for ACTIVE - // capacity commitments. - google.protobuf.Timestamp commitment_end_time = 5 [(google.api.field_behavior) = OUTPUT_ONLY]; + // Output only. The end of the current commitment period. It is applicable + // only for ACTIVE capacity commitments. + google.protobuf.Timestamp commitment_end_time = 5 + [(google.api.field_behavior) = OUTPUT_ONLY]; // Output only. For FAILED commitment plan, provides the reason of failure. - google.rpc.Status failure_status = 7 [(google.api.field_behavior) = OUTPUT_ONLY]; + google.rpc.Status failure_status = 7 + [(google.api.field_behavior) = OUTPUT_ONLY]; // The plan this capacity commitment is converted to after commitment_end_time // passes. Once the plan is changed, committed period is extended according to @@ -538,9 +601,13 @@ message CapacityCommitment { // secondary region which is designated for disaster recovery purposes. // If false, this commitment is placed in the organization's default region. bool multi_region_auxiliary = 10; + + // Edition of the capacity commitment. + Edition edition = 12; } -// The request for [ReservationService.CreateReservation][google.cloud.bigquery.reservation.v1.ReservationService.CreateReservation]. +// The request for +// [ReservationService.CreateReservation][google.cloud.bigquery.reservation.v1.ReservationService.CreateReservation]. message CreateReservationRequest { // Required. Project, location. E.g., // `projects/myproject/locations/US` @@ -560,7 +627,8 @@ message CreateReservationRequest { Reservation reservation = 3; } -// The request for [ReservationService.ListReservations][google.cloud.bigquery.reservation.v1.ReservationService.ListReservations]. +// The request for +// [ReservationService.ListReservations][google.cloud.bigquery.reservation.v1.ReservationService.ListReservations]. message ListReservationsRequest { // Required. The parent resource name containing project and location, e.g.: // `projects/myproject/locations/US` @@ -578,7 +646,8 @@ message ListReservationsRequest { string page_token = 3; } -// The response for [ReservationService.ListReservations][google.cloud.bigquery.reservation.v1.ReservationService.ListReservations]. +// The response for +// [ReservationService.ListReservations][google.cloud.bigquery.reservation.v1.ReservationService.ListReservations]. message ListReservationsResponse { // List of reservations visible to the user. repeated Reservation reservations = 1; @@ -588,7 +657,8 @@ message ListReservationsResponse { string next_page_token = 2; } -// The request for [ReservationService.GetReservation][google.cloud.bigquery.reservation.v1.ReservationService.GetReservation]. +// The request for +// [ReservationService.GetReservation][google.cloud.bigquery.reservation.v1.ReservationService.GetReservation]. message GetReservationRequest { // Required. Resource name of the reservation to retrieve. E.g., // `projects/myproject/locations/US/reservations/team1-prod` @@ -600,7 +670,8 @@ message GetReservationRequest { ]; } -// The request for [ReservationService.DeleteReservation][google.cloud.bigquery.reservation.v1.ReservationService.DeleteReservation]. +// The request for +// [ReservationService.DeleteReservation][google.cloud.bigquery.reservation.v1.ReservationService.DeleteReservation]. message DeleteReservationRequest { // Required. Resource name of the reservation to retrieve. E.g., // `projects/myproject/locations/US/reservations/team1-prod` @@ -612,7 +683,8 @@ message DeleteReservationRequest { ]; } -// The request for [ReservationService.UpdateReservation][google.cloud.bigquery.reservation.v1.ReservationService.UpdateReservation]. +// The request for +// [ReservationService.UpdateReservation][google.cloud.bigquery.reservation.v1.ReservationService.UpdateReservation]. message UpdateReservationRequest { // Content of the reservation to update. Reservation reservation = 1; @@ -621,7 +693,8 @@ message UpdateReservationRequest { google.protobuf.FieldMask update_mask = 2; } -// The request for [ReservationService.CreateCapacityCommitment][google.cloud.bigquery.reservation.v1.ReservationService.CreateCapacityCommitment]. +// The request for +// [ReservationService.CreateCapacityCommitment][google.cloud.bigquery.reservation.v1.ReservationService.CreateCapacityCommitment]. message CreateCapacityCommitmentRequest { // Required. Resource name of the parent reservation. E.g., // `projects/myproject/locations/US` @@ -647,7 +720,8 @@ message CreateCapacityCommitmentRequest { string capacity_commitment_id = 5; } -// The request for [ReservationService.ListCapacityCommitments][google.cloud.bigquery.reservation.v1.ReservationService.ListCapacityCommitments]. +// The request for +// [ReservationService.ListCapacityCommitments][google.cloud.bigquery.reservation.v1.ReservationService.ListCapacityCommitments]. message ListCapacityCommitmentsRequest { // Required. Resource name of the parent reservation. E.g., // `projects/myproject/locations/US` @@ -665,7 +739,8 @@ message ListCapacityCommitmentsRequest { string page_token = 3; } -// The response for [ReservationService.ListCapacityCommitments][google.cloud.bigquery.reservation.v1.ReservationService.ListCapacityCommitments]. +// The response for +// [ReservationService.ListCapacityCommitments][google.cloud.bigquery.reservation.v1.ReservationService.ListCapacityCommitments]. message ListCapacityCommitmentsResponse { // List of capacity commitments visible to the user. repeated CapacityCommitment capacity_commitments = 1; @@ -675,7 +750,8 @@ message ListCapacityCommitmentsResponse { string next_page_token = 2; } -// The request for [ReservationService.GetCapacityCommitment][google.cloud.bigquery.reservation.v1.ReservationService.GetCapacityCommitment]. +// The request for +// [ReservationService.GetCapacityCommitment][google.cloud.bigquery.reservation.v1.ReservationService.GetCapacityCommitment]. message GetCapacityCommitmentRequest { // Required. Resource name of the capacity commitment to retrieve. E.g., // `projects/myproject/locations/US/capacityCommitments/123` @@ -687,7 +763,8 @@ message GetCapacityCommitmentRequest { ]; } -// The request for [ReservationService.DeleteCapacityCommitment][google.cloud.bigquery.reservation.v1.ReservationService.DeleteCapacityCommitment]. +// The request for +// [ReservationService.DeleteCapacityCommitment][google.cloud.bigquery.reservation.v1.ReservationService.DeleteCapacityCommitment]. message DeleteCapacityCommitmentRequest { // Required. Resource name of the capacity commitment to delete. E.g., // `projects/myproject/locations/US/capacityCommitments/123` @@ -704,7 +781,8 @@ message DeleteCapacityCommitmentRequest { bool force = 3; } -// The request for [ReservationService.UpdateCapacityCommitment][google.cloud.bigquery.reservation.v1.ReservationService.UpdateCapacityCommitment]. +// The request for +// [ReservationService.UpdateCapacityCommitment][google.cloud.bigquery.reservation.v1.ReservationService.UpdateCapacityCommitment]. message UpdateCapacityCommitmentRequest { // Content of the capacity commitment to update. CapacityCommitment capacity_commitment = 1; @@ -713,7 +791,8 @@ message UpdateCapacityCommitmentRequest { google.protobuf.FieldMask update_mask = 2; } -// The request for [ReservationService.SplitCapacityCommitment][google.cloud.bigquery.reservation.v1.ReservationService.SplitCapacityCommitment]. +// The request for +// [ReservationService.SplitCapacityCommitment][google.cloud.bigquery.reservation.v1.ReservationService.SplitCapacityCommitment]. message SplitCapacityCommitmentRequest { // Required. The resource name e.g.,: // `projects/myproject/locations/US/capacityCommitments/123` @@ -728,7 +807,8 @@ message SplitCapacityCommitmentRequest { int64 slot_count = 2; } -// The response for [ReservationService.SplitCapacityCommitment][google.cloud.bigquery.reservation.v1.ReservationService.SplitCapacityCommitment]. +// The response for +// [ReservationService.SplitCapacityCommitment][google.cloud.bigquery.reservation.v1.ReservationService.SplitCapacityCommitment]. message SplitCapacityCommitmentResponse { // First capacity commitment, result of a split. CapacityCommitment first = 1; @@ -737,13 +817,14 @@ message SplitCapacityCommitmentResponse { CapacityCommitment second = 2; } -// The request for [ReservationService.MergeCapacityCommitments][google.cloud.bigquery.reservation.v1.ReservationService.MergeCapacityCommitments]. +// The request for +// [ReservationService.MergeCapacityCommitments][google.cloud.bigquery.reservation.v1.ReservationService.MergeCapacityCommitments]. message MergeCapacityCommitmentsRequest { // Parent resource that identifies admin project and location e.g., // `projects/myproject/locations/us` string parent = 1 [(google.api.resource_reference) = { - child_type: "bigqueryreservation.googleapis.com/CapacityCommitment" - }]; + child_type: "bigqueryreservation.googleapis.com/CapacityCommitment" + }]; // Ids of capacity commitments to merge. // These capacity commitments must exist under admin project and location @@ -776,6 +857,9 @@ message Assignment { // BigQuery ML jobs that use services external to BigQuery for model // training. These jobs will not utilize idle slots from other reservations. ML_EXTERNAL = 3; + + // Background jobs that BigQuery runs for the customers in the background. + BACKGROUND = 4; } // Assignment will remain in PENDING state if no active capacity commitment is @@ -810,7 +894,8 @@ message Assignment { State state = 6 [(google.api.field_behavior) = OUTPUT_ONLY]; } -// The request for [ReservationService.CreateAssignment][google.cloud.bigquery.reservation.v1.ReservationService.CreateAssignment]. +// The request for +// [ReservationService.CreateAssignment][google.cloud.bigquery.reservation.v1.ReservationService.CreateAssignment]. // Note: "bigquery.reservationAssignments.create" permission is required on the // related assignee. message CreateAssignmentRequest { @@ -833,7 +918,8 @@ message CreateAssignmentRequest { string assignment_id = 4; } -// The request for [ReservationService.ListAssignments][google.cloud.bigquery.reservation.v1.ReservationService.ListAssignments]. +// The request for +// [ReservationService.ListAssignments][google.cloud.bigquery.reservation.v1.ReservationService.ListAssignments]. message ListAssignmentsRequest { // Required. The parent resource name e.g.: // @@ -856,7 +942,8 @@ message ListAssignmentsRequest { string page_token = 3; } -// The response for [ReservationService.ListAssignments][google.cloud.bigquery.reservation.v1.ReservationService.ListAssignments]. +// The response for +// [ReservationService.ListAssignments][google.cloud.bigquery.reservation.v1.ReservationService.ListAssignments]. message ListAssignmentsResponse { // List of assignments visible to the user. repeated Assignment assignments = 1; @@ -866,7 +953,8 @@ message ListAssignmentsResponse { string next_page_token = 2; } -// The request for [ReservationService.DeleteAssignment][google.cloud.bigquery.reservation.v1.ReservationService.DeleteAssignment]. +// The request for +// [ReservationService.DeleteAssignment][google.cloud.bigquery.reservation.v1.ReservationService.DeleteAssignment]. // Note: "bigquery.reservationAssignments.delete" permission is required on the // related assignee. message DeleteAssignmentRequest { @@ -885,8 +973,8 @@ message DeleteAssignmentRequest { // Note: "bigquery.reservationAssignments.search" permission is required on the // related assignee. message SearchAssignmentsRequest { - // Required. The resource name of the admin project(containing project and location), - // e.g.: + // Required. The resource name of the admin project(containing project and + // location), e.g.: // `projects/myproject/locations/US`. string parent = 1 [ (google.api.field_behavior) = REQUIRED, @@ -916,8 +1004,8 @@ message SearchAssignmentsRequest { // Note: "bigquery.reservationAssignments.search" permission is required on the // related assignee. message SearchAllAssignmentsRequest { - // Required. The resource name with location (project name could be the wildcard '-'), - // e.g.: + // Required. The resource name with location (project name could be the + // wildcard '-'), e.g.: // `projects/-/locations/US`. string parent = 1 [ (google.api.field_behavior) = REQUIRED, @@ -942,7 +1030,8 @@ message SearchAllAssignmentsRequest { string page_token = 4; } -// The response for [ReservationService.SearchAssignments][google.cloud.bigquery.reservation.v1.ReservationService.SearchAssignments]. +// The response for +// [ReservationService.SearchAssignments][google.cloud.bigquery.reservation.v1.ReservationService.SearchAssignments]. message SearchAssignmentsResponse { // List of assignments visible to the user. repeated Assignment assignments = 1; @@ -952,7 +1041,8 @@ message SearchAssignmentsResponse { string next_page_token = 2; } -// The response for [ReservationService.SearchAllAssignments][google.cloud.bigquery.reservation.v1.ReservationService.SearchAllAssignments]. +// The response for +// [ReservationService.SearchAllAssignments][google.cloud.bigquery.reservation.v1.ReservationService.SearchAllAssignments]. message SearchAllAssignmentsResponse { // List of assignments visible to the user. repeated Assignment assignments = 1; @@ -985,11 +1075,19 @@ message MoveAssignmentRequest { // The new reservation ID, e.g.: // `projects/myotherproject/locations/US/reservations/team2-prod` string destination_id = 3 [(google.api.resource_reference) = { - child_type: "bigqueryreservation.googleapis.com/Assignment" - }]; + child_type: "bigqueryreservation.googleapis.com/Assignment" + }]; + + // The optional assignment ID. A new assignment name is generated if this + // field is empty. + // + // This field can contain only lowercase alphanumeric characters or dashes. + // Max length is 64 characters. + string assignment_id = 5; } -// The request for [ReservationService.UpdateAssignment][google.cloud.bigquery.reservation.v1.ReservationService.UpdateAssignment]. +// The request for +// [ReservationService.UpdateAssignment][google.cloud.bigquery.reservation.v1.ReservationService.UpdateAssignment]. message UpdateAssignmentRequest { // Content of the assignment to update. Assignment assignment = 1; @@ -1024,7 +1122,8 @@ message BiReservation { string name = 1; // Output only. The last update timestamp of a reservation. - google.protobuf.Timestamp update_time = 3 [(google.api.field_behavior) = OUTPUT_ONLY]; + google.protobuf.Timestamp update_time = 3 + [(google.api.field_behavior) = OUTPUT_ONLY]; // Size of a reservation, in bytes. int64 size = 4; @@ -1053,3 +1152,20 @@ message UpdateBiReservationRequest { // A list of fields to be updated in this request. google.protobuf.FieldMask update_mask = 2; } + +// The type of editions. +// Different features and behaviors are provided to different editions +// Capacity commitments and reservations are linked to editions. +enum Edition { + // Default value, which will be treated as ENTERPRISE. + EDITION_UNSPECIFIED = 0; + + // Standard edition. + STANDARD = 1; + + // Enterprise edition. + ENTERPRISE = 2; + + // Enterprise plus edition. + ENTERPRISE_PLUS = 3; +} diff --git a/packages/google-cloud-bigquery-reservation/protos/protos.d.ts b/packages/google-cloud-bigquery-reservation/protos/protos.d.ts index f3433266a16..1ad731cb3ae 100644 --- a/packages/google-cloud-bigquery-reservation/protos/protos.d.ts +++ b/packages/google-cloud-bigquery-reservation/protos/protos.d.ts @@ -506,6 +506,9 @@ export namespace google { /** Reservation ignoreIdleSlots */ ignoreIdleSlots?: (boolean|null); + /** Reservation autoscale */ + autoscale?: (google.cloud.bigquery.reservation.v1.Reservation.IAutoscale|null); + /** Reservation concurrency */ concurrency?: (number|Long|string|null); @@ -517,6 +520,9 @@ export namespace google { /** Reservation multiRegionAuxiliary */ multiRegionAuxiliary?: (boolean|null); + + /** Reservation edition */ + edition?: (google.cloud.bigquery.reservation.v1.Edition|keyof typeof google.cloud.bigquery.reservation.v1.Edition|null); } /** Represents a Reservation. */ @@ -537,6 +543,9 @@ export namespace google { /** Reservation ignoreIdleSlots. */ public ignoreIdleSlots: boolean; + /** Reservation autoscale. */ + public autoscale?: (google.cloud.bigquery.reservation.v1.Reservation.IAutoscale|null); + /** Reservation concurrency. */ public concurrency: (number|Long|string); @@ -549,6 +558,9 @@ export namespace google { /** Reservation multiRegionAuxiliary. */ public multiRegionAuxiliary: boolean; + /** Reservation edition. */ + public edition: (google.cloud.bigquery.reservation.v1.Edition|keyof typeof google.cloud.bigquery.reservation.v1.Edition); + /** * Creates a new Reservation instance using the specified properties. * @param [properties] Properties to set @@ -627,6 +639,112 @@ export namespace google { public static getTypeUrl(typeUrlPrefix?: string): string; } + namespace Reservation { + + /** Properties of an Autoscale. */ + interface IAutoscale { + + /** Autoscale currentSlots */ + currentSlots?: (number|Long|string|null); + + /** Autoscale maxSlots */ + maxSlots?: (number|Long|string|null); + } + + /** Represents an Autoscale. */ + class Autoscale implements IAutoscale { + + /** + * Constructs a new Autoscale. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.bigquery.reservation.v1.Reservation.IAutoscale); + + /** Autoscale currentSlots. */ + public currentSlots: (number|Long|string); + + /** Autoscale maxSlots. */ + public maxSlots: (number|Long|string); + + /** + * Creates a new Autoscale instance using the specified properties. + * @param [properties] Properties to set + * @returns Autoscale instance + */ + public static create(properties?: google.cloud.bigquery.reservation.v1.Reservation.IAutoscale): google.cloud.bigquery.reservation.v1.Reservation.Autoscale; + + /** + * Encodes the specified Autoscale message. Does not implicitly {@link google.cloud.bigquery.reservation.v1.Reservation.Autoscale.verify|verify} messages. + * @param message Autoscale message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.bigquery.reservation.v1.Reservation.IAutoscale, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified Autoscale message, length delimited. Does not implicitly {@link google.cloud.bigquery.reservation.v1.Reservation.Autoscale.verify|verify} messages. + * @param message Autoscale message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.bigquery.reservation.v1.Reservation.IAutoscale, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes an Autoscale message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns Autoscale + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.bigquery.reservation.v1.Reservation.Autoscale; + + /** + * Decodes an Autoscale message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns Autoscale + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.bigquery.reservation.v1.Reservation.Autoscale; + + /** + * Verifies an Autoscale message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates an Autoscale message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns Autoscale + */ + public static fromObject(object: { [k: string]: any }): google.cloud.bigquery.reservation.v1.Reservation.Autoscale; + + /** + * Creates a plain object from an Autoscale message. Also converts values to other types if specified. + * @param message Autoscale + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.bigquery.reservation.v1.Reservation.Autoscale, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this Autoscale to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for Autoscale + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + } + /** Properties of a CapacityCommitment. */ interface ICapacityCommitment { @@ -656,6 +774,9 @@ export namespace google { /** CapacityCommitment multiRegionAuxiliary */ multiRegionAuxiliary?: (boolean|null); + + /** CapacityCommitment edition */ + edition?: (google.cloud.bigquery.reservation.v1.Edition|keyof typeof google.cloud.bigquery.reservation.v1.Edition|null); } /** Represents a CapacityCommitment. */ @@ -694,6 +815,9 @@ export namespace google { /** CapacityCommitment multiRegionAuxiliary. */ public multiRegionAuxiliary: boolean; + /** CapacityCommitment edition. */ + public edition: (google.cloud.bigquery.reservation.v1.Edition|keyof typeof google.cloud.bigquery.reservation.v1.Edition); + /** * Creates a new CapacityCommitment instance using the specified properties. * @param [properties] Properties to set @@ -778,9 +902,14 @@ export namespace google { enum CommitmentPlan { COMMITMENT_PLAN_UNSPECIFIED = 0, FLEX = 3, + FLEX_FLAT_RATE = 7, TRIAL = 5, MONTHLY = 2, - ANNUAL = 4 + MONTHLY_FLAT_RATE = 8, + ANNUAL = 4, + ANNUAL_FLAT_RATE = 9, + THREE_YEAR = 10, + NONE = 6 } /** State enum. */ @@ -2471,7 +2600,8 @@ export namespace google { JOB_TYPE_UNSPECIFIED = 0, PIPELINE = 1, QUERY = 2, - ML_EXTERNAL = 3 + ML_EXTERNAL = 3, + BACKGROUND = 4 } /** State enum. */ @@ -3344,6 +3474,9 @@ export namespace google { /** MoveAssignmentRequest destinationId */ destinationId?: (string|null); + + /** MoveAssignmentRequest assignmentId */ + assignmentId?: (string|null); } /** Represents a MoveAssignmentRequest. */ @@ -3361,6 +3494,9 @@ export namespace google { /** MoveAssignmentRequest destinationId. */ public destinationId: string; + /** MoveAssignmentRequest assignmentId. */ + public assignmentId: string; + /** * Creates a new MoveAssignmentRequest instance using the specified properties. * @param [properties] Properties to set @@ -3965,6 +4101,14 @@ export namespace google { */ public static getTypeUrl(typeUrlPrefix?: string): string; } + + /** Edition enum. */ + enum Edition { + EDITION_UNSPECIFIED = 0, + STANDARD = 1, + ENTERPRISE = 2, + ENTERPRISE_PLUS = 3 + } } } } diff --git a/packages/google-cloud-bigquery-reservation/protos/protos.js b/packages/google-cloud-bigquery-reservation/protos/protos.js index 04a7299fd65..9f9d7e2a9e9 100644 --- a/packages/google-cloud-bigquery-reservation/protos/protos.js +++ b/packages/google-cloud-bigquery-reservation/protos/protos.js @@ -812,10 +812,12 @@ * @property {string|null} [name] Reservation name * @property {number|Long|null} [slotCapacity] Reservation slotCapacity * @property {boolean|null} [ignoreIdleSlots] Reservation ignoreIdleSlots + * @property {google.cloud.bigquery.reservation.v1.Reservation.IAutoscale|null} [autoscale] Reservation autoscale * @property {number|Long|null} [concurrency] Reservation concurrency * @property {google.protobuf.ITimestamp|null} [creationTime] Reservation creationTime * @property {google.protobuf.ITimestamp|null} [updateTime] Reservation updateTime * @property {boolean|null} [multiRegionAuxiliary] Reservation multiRegionAuxiliary + * @property {google.cloud.bigquery.reservation.v1.Edition|null} [edition] Reservation edition */ /** @@ -857,6 +859,14 @@ */ Reservation.prototype.ignoreIdleSlots = false; + /** + * Reservation autoscale. + * @member {google.cloud.bigquery.reservation.v1.Reservation.IAutoscale|null|undefined} autoscale + * @memberof google.cloud.bigquery.reservation.v1.Reservation + * @instance + */ + Reservation.prototype.autoscale = null; + /** * Reservation concurrency. * @member {number|Long} concurrency @@ -889,6 +899,14 @@ */ Reservation.prototype.multiRegionAuxiliary = false; + /** + * Reservation edition. + * @member {google.cloud.bigquery.reservation.v1.Edition} edition + * @memberof google.cloud.bigquery.reservation.v1.Reservation + * @instance + */ + Reservation.prototype.edition = 0; + /** * Creates a new Reservation instance using the specified properties. * @function create @@ -919,6 +937,8 @@ writer.uint32(/* id 2, wireType 0 =*/16).int64(message.slotCapacity); if (message.ignoreIdleSlots != null && Object.hasOwnProperty.call(message, "ignoreIdleSlots")) writer.uint32(/* id 4, wireType 0 =*/32).bool(message.ignoreIdleSlots); + if (message.autoscale != null && Object.hasOwnProperty.call(message, "autoscale")) + $root.google.cloud.bigquery.reservation.v1.Reservation.Autoscale.encode(message.autoscale, writer.uint32(/* id 7, wireType 2 =*/58).fork()).ldelim(); if (message.creationTime != null && Object.hasOwnProperty.call(message, "creationTime")) $root.google.protobuf.Timestamp.encode(message.creationTime, writer.uint32(/* id 8, wireType 2 =*/66).fork()).ldelim(); if (message.updateTime != null && Object.hasOwnProperty.call(message, "updateTime")) @@ -927,6 +947,8 @@ writer.uint32(/* id 14, wireType 0 =*/112).bool(message.multiRegionAuxiliary); if (message.concurrency != null && Object.hasOwnProperty.call(message, "concurrency")) writer.uint32(/* id 16, wireType 0 =*/128).int64(message.concurrency); + if (message.edition != null && Object.hasOwnProperty.call(message, "edition")) + writer.uint32(/* id 17, wireType 0 =*/136).int32(message.edition); return writer; }; @@ -973,6 +995,10 @@ message.ignoreIdleSlots = reader.bool(); break; } + case 7: { + message.autoscale = $root.google.cloud.bigquery.reservation.v1.Reservation.Autoscale.decode(reader, reader.uint32()); + break; + } case 16: { message.concurrency = reader.int64(); break; @@ -989,6 +1015,10 @@ message.multiRegionAuxiliary = reader.bool(); break; } + case 17: { + message.edition = reader.int32(); + break; + } default: reader.skipType(tag & 7); break; @@ -1033,6 +1063,11 @@ if (message.ignoreIdleSlots != null && message.hasOwnProperty("ignoreIdleSlots")) if (typeof message.ignoreIdleSlots !== "boolean") return "ignoreIdleSlots: boolean expected"; + if (message.autoscale != null && message.hasOwnProperty("autoscale")) { + var error = $root.google.cloud.bigquery.reservation.v1.Reservation.Autoscale.verify(message.autoscale); + if (error) + return "autoscale." + error; + } if (message.concurrency != null && message.hasOwnProperty("concurrency")) if (!$util.isInteger(message.concurrency) && !(message.concurrency && $util.isInteger(message.concurrency.low) && $util.isInteger(message.concurrency.high))) return "concurrency: integer|Long expected"; @@ -1049,6 +1084,16 @@ if (message.multiRegionAuxiliary != null && message.hasOwnProperty("multiRegionAuxiliary")) if (typeof message.multiRegionAuxiliary !== "boolean") return "multiRegionAuxiliary: boolean expected"; + if (message.edition != null && message.hasOwnProperty("edition")) + switch (message.edition) { + default: + return "edition: enum value expected"; + case 0: + case 1: + case 2: + case 3: + break; + } return null; }; @@ -1077,6 +1122,11 @@ message.slotCapacity = new $util.LongBits(object.slotCapacity.low >>> 0, object.slotCapacity.high >>> 0).toNumber(); if (object.ignoreIdleSlots != null) message.ignoreIdleSlots = Boolean(object.ignoreIdleSlots); + if (object.autoscale != null) { + if (typeof object.autoscale !== "object") + throw TypeError(".google.cloud.bigquery.reservation.v1.Reservation.autoscale: object expected"); + message.autoscale = $root.google.cloud.bigquery.reservation.v1.Reservation.Autoscale.fromObject(object.autoscale); + } if (object.concurrency != null) if ($util.Long) (message.concurrency = $util.Long.fromValue(object.concurrency)).unsigned = false; @@ -1098,6 +1148,30 @@ } if (object.multiRegionAuxiliary != null) message.multiRegionAuxiliary = Boolean(object.multiRegionAuxiliary); + switch (object.edition) { + default: + if (typeof object.edition === "number") { + message.edition = object.edition; + break; + } + break; + case "EDITION_UNSPECIFIED": + case 0: + message.edition = 0; + break; + case "STANDARD": + case 1: + message.edition = 1; + break; + case "ENTERPRISE": + case 2: + message.edition = 2; + break; + case "ENTERPRISE_PLUS": + case 3: + message.edition = 3; + break; + } return message; }; @@ -1122,6 +1196,7 @@ } else object.slotCapacity = options.longs === String ? "0" : 0; object.ignoreIdleSlots = false; + object.autoscale = null; object.creationTime = null; object.updateTime = null; object.multiRegionAuxiliary = false; @@ -1130,6 +1205,7 @@ object.concurrency = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; } else object.concurrency = options.longs === String ? "0" : 0; + object.edition = options.enums === String ? "EDITION_UNSPECIFIED" : 0; } if (message.name != null && message.hasOwnProperty("name")) object.name = message.name; @@ -1140,6 +1216,8 @@ object.slotCapacity = options.longs === String ? $util.Long.prototype.toString.call(message.slotCapacity) : options.longs === Number ? new $util.LongBits(message.slotCapacity.low >>> 0, message.slotCapacity.high >>> 0).toNumber() : message.slotCapacity; if (message.ignoreIdleSlots != null && message.hasOwnProperty("ignoreIdleSlots")) object.ignoreIdleSlots = message.ignoreIdleSlots; + if (message.autoscale != null && message.hasOwnProperty("autoscale")) + object.autoscale = $root.google.cloud.bigquery.reservation.v1.Reservation.Autoscale.toObject(message.autoscale, options); if (message.creationTime != null && message.hasOwnProperty("creationTime")) object.creationTime = $root.google.protobuf.Timestamp.toObject(message.creationTime, options); if (message.updateTime != null && message.hasOwnProperty("updateTime")) @@ -1151,6 +1229,8 @@ object.concurrency = options.longs === String ? String(message.concurrency) : message.concurrency; else object.concurrency = options.longs === String ? $util.Long.prototype.toString.call(message.concurrency) : options.longs === Number ? new $util.LongBits(message.concurrency.low >>> 0, message.concurrency.high >>> 0).toNumber() : message.concurrency; + if (message.edition != null && message.hasOwnProperty("edition")) + object.edition = options.enums === String ? $root.google.cloud.bigquery.reservation.v1.Edition[message.edition] === undefined ? message.edition : $root.google.cloud.bigquery.reservation.v1.Edition[message.edition] : message.edition; return object; }; @@ -1180,6 +1260,261 @@ return typeUrlPrefix + "/google.cloud.bigquery.reservation.v1.Reservation"; }; + Reservation.Autoscale = (function() { + + /** + * Properties of an Autoscale. + * @memberof google.cloud.bigquery.reservation.v1.Reservation + * @interface IAutoscale + * @property {number|Long|null} [currentSlots] Autoscale currentSlots + * @property {number|Long|null} [maxSlots] Autoscale maxSlots + */ + + /** + * Constructs a new Autoscale. + * @memberof google.cloud.bigquery.reservation.v1.Reservation + * @classdesc Represents an Autoscale. + * @implements IAutoscale + * @constructor + * @param {google.cloud.bigquery.reservation.v1.Reservation.IAutoscale=} [properties] Properties to set + */ + function Autoscale(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * Autoscale currentSlots. + * @member {number|Long} currentSlots + * @memberof google.cloud.bigquery.reservation.v1.Reservation.Autoscale + * @instance + */ + Autoscale.prototype.currentSlots = $util.Long ? $util.Long.fromBits(0,0,false) : 0; + + /** + * Autoscale maxSlots. + * @member {number|Long} maxSlots + * @memberof google.cloud.bigquery.reservation.v1.Reservation.Autoscale + * @instance + */ + Autoscale.prototype.maxSlots = $util.Long ? $util.Long.fromBits(0,0,false) : 0; + + /** + * Creates a new Autoscale instance using the specified properties. + * @function create + * @memberof google.cloud.bigquery.reservation.v1.Reservation.Autoscale + * @static + * @param {google.cloud.bigquery.reservation.v1.Reservation.IAutoscale=} [properties] Properties to set + * @returns {google.cloud.bigquery.reservation.v1.Reservation.Autoscale} Autoscale instance + */ + Autoscale.create = function create(properties) { + return new Autoscale(properties); + }; + + /** + * Encodes the specified Autoscale message. Does not implicitly {@link google.cloud.bigquery.reservation.v1.Reservation.Autoscale.verify|verify} messages. + * @function encode + * @memberof google.cloud.bigquery.reservation.v1.Reservation.Autoscale + * @static + * @param {google.cloud.bigquery.reservation.v1.Reservation.IAutoscale} message Autoscale message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Autoscale.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.currentSlots != null && Object.hasOwnProperty.call(message, "currentSlots")) + writer.uint32(/* id 1, wireType 0 =*/8).int64(message.currentSlots); + if (message.maxSlots != null && Object.hasOwnProperty.call(message, "maxSlots")) + writer.uint32(/* id 2, wireType 0 =*/16).int64(message.maxSlots); + return writer; + }; + + /** + * Encodes the specified Autoscale message, length delimited. Does not implicitly {@link google.cloud.bigquery.reservation.v1.Reservation.Autoscale.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.bigquery.reservation.v1.Reservation.Autoscale + * @static + * @param {google.cloud.bigquery.reservation.v1.Reservation.IAutoscale} message Autoscale message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Autoscale.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes an Autoscale message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.bigquery.reservation.v1.Reservation.Autoscale + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.bigquery.reservation.v1.Reservation.Autoscale} Autoscale + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Autoscale.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.bigquery.reservation.v1.Reservation.Autoscale(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.currentSlots = reader.int64(); + break; + } + case 2: { + message.maxSlots = reader.int64(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes an Autoscale message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.bigquery.reservation.v1.Reservation.Autoscale + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.bigquery.reservation.v1.Reservation.Autoscale} Autoscale + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Autoscale.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies an Autoscale message. + * @function verify + * @memberof google.cloud.bigquery.reservation.v1.Reservation.Autoscale + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + Autoscale.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.currentSlots != null && message.hasOwnProperty("currentSlots")) + if (!$util.isInteger(message.currentSlots) && !(message.currentSlots && $util.isInteger(message.currentSlots.low) && $util.isInteger(message.currentSlots.high))) + return "currentSlots: integer|Long expected"; + if (message.maxSlots != null && message.hasOwnProperty("maxSlots")) + if (!$util.isInteger(message.maxSlots) && !(message.maxSlots && $util.isInteger(message.maxSlots.low) && $util.isInteger(message.maxSlots.high))) + return "maxSlots: integer|Long expected"; + return null; + }; + + /** + * Creates an Autoscale message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.bigquery.reservation.v1.Reservation.Autoscale + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.bigquery.reservation.v1.Reservation.Autoscale} Autoscale + */ + Autoscale.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.bigquery.reservation.v1.Reservation.Autoscale) + return object; + var message = new $root.google.cloud.bigquery.reservation.v1.Reservation.Autoscale(); + if (object.currentSlots != null) + if ($util.Long) + (message.currentSlots = $util.Long.fromValue(object.currentSlots)).unsigned = false; + else if (typeof object.currentSlots === "string") + message.currentSlots = parseInt(object.currentSlots, 10); + else if (typeof object.currentSlots === "number") + message.currentSlots = object.currentSlots; + else if (typeof object.currentSlots === "object") + message.currentSlots = new $util.LongBits(object.currentSlots.low >>> 0, object.currentSlots.high >>> 0).toNumber(); + if (object.maxSlots != null) + if ($util.Long) + (message.maxSlots = $util.Long.fromValue(object.maxSlots)).unsigned = false; + else if (typeof object.maxSlots === "string") + message.maxSlots = parseInt(object.maxSlots, 10); + else if (typeof object.maxSlots === "number") + message.maxSlots = object.maxSlots; + else if (typeof object.maxSlots === "object") + message.maxSlots = new $util.LongBits(object.maxSlots.low >>> 0, object.maxSlots.high >>> 0).toNumber(); + return message; + }; + + /** + * Creates a plain object from an Autoscale message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.bigquery.reservation.v1.Reservation.Autoscale + * @static + * @param {google.cloud.bigquery.reservation.v1.Reservation.Autoscale} message Autoscale + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + Autoscale.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + if ($util.Long) { + var long = new $util.Long(0, 0, false); + object.currentSlots = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; + } else + object.currentSlots = options.longs === String ? "0" : 0; + if ($util.Long) { + var long = new $util.Long(0, 0, false); + object.maxSlots = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; + } else + object.maxSlots = options.longs === String ? "0" : 0; + } + if (message.currentSlots != null && message.hasOwnProperty("currentSlots")) + if (typeof message.currentSlots === "number") + object.currentSlots = options.longs === String ? String(message.currentSlots) : message.currentSlots; + else + object.currentSlots = options.longs === String ? $util.Long.prototype.toString.call(message.currentSlots) : options.longs === Number ? new $util.LongBits(message.currentSlots.low >>> 0, message.currentSlots.high >>> 0).toNumber() : message.currentSlots; + if (message.maxSlots != null && message.hasOwnProperty("maxSlots")) + if (typeof message.maxSlots === "number") + object.maxSlots = options.longs === String ? String(message.maxSlots) : message.maxSlots; + else + object.maxSlots = options.longs === String ? $util.Long.prototype.toString.call(message.maxSlots) : options.longs === Number ? new $util.LongBits(message.maxSlots.low >>> 0, message.maxSlots.high >>> 0).toNumber() : message.maxSlots; + return object; + }; + + /** + * Converts this Autoscale to JSON. + * @function toJSON + * @memberof google.cloud.bigquery.reservation.v1.Reservation.Autoscale + * @instance + * @returns {Object.} JSON object + */ + Autoscale.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for Autoscale + * @function getTypeUrl + * @memberof google.cloud.bigquery.reservation.v1.Reservation.Autoscale + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + Autoscale.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.bigquery.reservation.v1.Reservation.Autoscale"; + }; + + return Autoscale; + })(); + return Reservation; })(); @@ -1198,6 +1533,7 @@ * @property {google.rpc.IStatus|null} [failureStatus] CapacityCommitment failureStatus * @property {google.cloud.bigquery.reservation.v1.CapacityCommitment.CommitmentPlan|null} [renewalPlan] CapacityCommitment renewalPlan * @property {boolean|null} [multiRegionAuxiliary] CapacityCommitment multiRegionAuxiliary + * @property {google.cloud.bigquery.reservation.v1.Edition|null} [edition] CapacityCommitment edition */ /** @@ -1287,6 +1623,14 @@ */ CapacityCommitment.prototype.multiRegionAuxiliary = false; + /** + * CapacityCommitment edition. + * @member {google.cloud.bigquery.reservation.v1.Edition} edition + * @memberof google.cloud.bigquery.reservation.v1.CapacityCommitment + * @instance + */ + CapacityCommitment.prototype.edition = 0; + /** * Creates a new CapacityCommitment instance using the specified properties. * @function create @@ -1329,6 +1673,8 @@ $root.google.protobuf.Timestamp.encode(message.commitmentStartTime, writer.uint32(/* id 9, wireType 2 =*/74).fork()).ldelim(); if (message.multiRegionAuxiliary != null && Object.hasOwnProperty.call(message, "multiRegionAuxiliary")) writer.uint32(/* id 10, wireType 0 =*/80).bool(message.multiRegionAuxiliary); + if (message.edition != null && Object.hasOwnProperty.call(message, "edition")) + writer.uint32(/* id 12, wireType 0 =*/96).int32(message.edition); return writer; }; @@ -1399,6 +1745,10 @@ message.multiRegionAuxiliary = reader.bool(); break; } + case 12: { + message.edition = reader.int32(); + break; + } default: reader.skipType(tag & 7); break; @@ -1446,9 +1796,14 @@ return "plan: enum value expected"; case 0: case 3: + case 7: case 5: case 2: + case 8: case 4: + case 9: + case 10: + case 6: break; } if (message.state != null && message.hasOwnProperty("state")) @@ -1482,14 +1837,29 @@ return "renewalPlan: enum value expected"; case 0: case 3: + case 7: case 5: case 2: + case 8: case 4: + case 9: + case 10: + case 6: break; } if (message.multiRegionAuxiliary != null && message.hasOwnProperty("multiRegionAuxiliary")) if (typeof message.multiRegionAuxiliary !== "boolean") return "multiRegionAuxiliary: boolean expected"; + if (message.edition != null && message.hasOwnProperty("edition")) + switch (message.edition) { + default: + return "edition: enum value expected"; + case 0: + case 1: + case 2: + case 3: + break; + } return null; }; @@ -1531,6 +1901,10 @@ case 3: message.plan = 3; break; + case "FLEX_FLAT_RATE": + case 7: + message.plan = 7; + break; case "TRIAL": case 5: message.plan = 5; @@ -1539,10 +1913,26 @@ case 2: message.plan = 2; break; + case "MONTHLY_FLAT_RATE": + case 8: + message.plan = 8; + break; case "ANNUAL": case 4: message.plan = 4; break; + case "ANNUAL_FLAT_RATE": + case 9: + message.plan = 9; + break; + case "THREE_YEAR": + case 10: + message.plan = 10; + break; + case "NONE": + case 6: + message.plan = 6; + break; } switch (object.state) { default: @@ -1598,6 +1988,10 @@ case 3: message.renewalPlan = 3; break; + case "FLEX_FLAT_RATE": + case 7: + message.renewalPlan = 7; + break; case "TRIAL": case 5: message.renewalPlan = 5; @@ -1606,13 +2000,53 @@ case 2: message.renewalPlan = 2; break; + case "MONTHLY_FLAT_RATE": + case 8: + message.renewalPlan = 8; + break; case "ANNUAL": case 4: message.renewalPlan = 4; break; + case "ANNUAL_FLAT_RATE": + case 9: + message.renewalPlan = 9; + break; + case "THREE_YEAR": + case 10: + message.renewalPlan = 10; + break; + case "NONE": + case 6: + message.renewalPlan = 6; + break; } if (object.multiRegionAuxiliary != null) message.multiRegionAuxiliary = Boolean(object.multiRegionAuxiliary); + switch (object.edition) { + default: + if (typeof object.edition === "number") { + message.edition = object.edition; + break; + } + break; + case "EDITION_UNSPECIFIED": + case 0: + message.edition = 0; + break; + case "STANDARD": + case 1: + message.edition = 1; + break; + case "ENTERPRISE": + case 2: + message.edition = 2; + break; + case "ENTERPRISE_PLUS": + case 3: + message.edition = 3; + break; + } return message; }; @@ -1643,6 +2077,7 @@ object.renewalPlan = options.enums === String ? "COMMITMENT_PLAN_UNSPECIFIED" : 0; object.commitmentStartTime = null; object.multiRegionAuxiliary = false; + object.edition = options.enums === String ? "EDITION_UNSPECIFIED" : 0; } if (message.name != null && message.hasOwnProperty("name")) object.name = message.name; @@ -1665,6 +2100,8 @@ object.commitmentStartTime = $root.google.protobuf.Timestamp.toObject(message.commitmentStartTime, options); if (message.multiRegionAuxiliary != null && message.hasOwnProperty("multiRegionAuxiliary")) object.multiRegionAuxiliary = message.multiRegionAuxiliary; + if (message.edition != null && message.hasOwnProperty("edition")) + object.edition = options.enums === String ? $root.google.cloud.bigquery.reservation.v1.Edition[message.edition] === undefined ? message.edition : $root.google.cloud.bigquery.reservation.v1.Edition[message.edition] : message.edition; return object; }; @@ -1700,17 +2137,27 @@ * @enum {number} * @property {number} COMMITMENT_PLAN_UNSPECIFIED=0 COMMITMENT_PLAN_UNSPECIFIED value * @property {number} FLEX=3 FLEX value + * @property {number} FLEX_FLAT_RATE=7 FLEX_FLAT_RATE value * @property {number} TRIAL=5 TRIAL value * @property {number} MONTHLY=2 MONTHLY value + * @property {number} MONTHLY_FLAT_RATE=8 MONTHLY_FLAT_RATE value * @property {number} ANNUAL=4 ANNUAL value + * @property {number} ANNUAL_FLAT_RATE=9 ANNUAL_FLAT_RATE value + * @property {number} THREE_YEAR=10 THREE_YEAR value + * @property {number} NONE=6 NONE value */ CapacityCommitment.CommitmentPlan = (function() { var valuesById = {}, values = Object.create(valuesById); values[valuesById[0] = "COMMITMENT_PLAN_UNSPECIFIED"] = 0; values[valuesById[3] = "FLEX"] = 3; + values[valuesById[7] = "FLEX_FLAT_RATE"] = 7; values[valuesById[5] = "TRIAL"] = 5; values[valuesById[2] = "MONTHLY"] = 2; + values[valuesById[8] = "MONTHLY_FLAT_RATE"] = 8; values[valuesById[4] = "ANNUAL"] = 4; + values[valuesById[9] = "ANNUAL_FLAT_RATE"] = 9; + values[valuesById[10] = "THREE_YEAR"] = 10; + values[valuesById[6] = "NONE"] = 6; return values; })(); @@ -5485,6 +5932,7 @@ case 1: case 2: case 3: + case 4: break; } if (message.state != null && message.hasOwnProperty("state")) @@ -5538,6 +5986,10 @@ case 3: message.jobType = 3; break; + case "BACKGROUND": + case 4: + message.jobType = 4; + break; } switch (object.state) { default: @@ -5626,6 +6078,7 @@ * @property {number} PIPELINE=1 PIPELINE value * @property {number} QUERY=2 QUERY value * @property {number} ML_EXTERNAL=3 ML_EXTERNAL value + * @property {number} BACKGROUND=4 BACKGROUND value */ Assignment.JobType = (function() { var valuesById = {}, values = Object.create(valuesById); @@ -5633,6 +6086,7 @@ values[valuesById[1] = "PIPELINE"] = 1; values[valuesById[2] = "QUERY"] = 2; values[valuesById[3] = "ML_EXTERNAL"] = 3; + values[valuesById[4] = "BACKGROUND"] = 4; return values; })(); @@ -7661,6 +8115,7 @@ * @interface IMoveAssignmentRequest * @property {string|null} [name] MoveAssignmentRequest name * @property {string|null} [destinationId] MoveAssignmentRequest destinationId + * @property {string|null} [assignmentId] MoveAssignmentRequest assignmentId */ /** @@ -7694,6 +8149,14 @@ */ MoveAssignmentRequest.prototype.destinationId = ""; + /** + * MoveAssignmentRequest assignmentId. + * @member {string} assignmentId + * @memberof google.cloud.bigquery.reservation.v1.MoveAssignmentRequest + * @instance + */ + MoveAssignmentRequest.prototype.assignmentId = ""; + /** * Creates a new MoveAssignmentRequest instance using the specified properties. * @function create @@ -7722,6 +8185,8 @@ writer.uint32(/* id 1, wireType 2 =*/10).string(message.name); if (message.destinationId != null && Object.hasOwnProperty.call(message, "destinationId")) writer.uint32(/* id 3, wireType 2 =*/26).string(message.destinationId); + if (message.assignmentId != null && Object.hasOwnProperty.call(message, "assignmentId")) + writer.uint32(/* id 5, wireType 2 =*/42).string(message.assignmentId); return writer; }; @@ -7764,6 +8229,10 @@ message.destinationId = reader.string(); break; } + case 5: { + message.assignmentId = reader.string(); + break; + } default: reader.skipType(tag & 7); break; @@ -7805,6 +8274,9 @@ if (message.destinationId != null && message.hasOwnProperty("destinationId")) if (!$util.isString(message.destinationId)) return "destinationId: string expected"; + if (message.assignmentId != null && message.hasOwnProperty("assignmentId")) + if (!$util.isString(message.assignmentId)) + return "assignmentId: string expected"; return null; }; @@ -7824,6 +8296,8 @@ message.name = String(object.name); if (object.destinationId != null) message.destinationId = String(object.destinationId); + if (object.assignmentId != null) + message.assignmentId = String(object.assignmentId); return message; }; @@ -7843,11 +8317,14 @@ if (options.defaults) { object.name = ""; object.destinationId = ""; + object.assignmentId = ""; } if (message.name != null && message.hasOwnProperty("name")) object.name = message.name; if (message.destinationId != null && message.hasOwnProperty("destinationId")) object.destinationId = message.destinationId; + if (message.assignmentId != null && message.hasOwnProperty("assignmentId")) + object.assignmentId = message.assignmentId; return object; }; @@ -9121,6 +9598,24 @@ return UpdateBiReservationRequest; })(); + /** + * Edition enum. + * @name google.cloud.bigquery.reservation.v1.Edition + * @enum {number} + * @property {number} EDITION_UNSPECIFIED=0 EDITION_UNSPECIFIED value + * @property {number} STANDARD=1 STANDARD value + * @property {number} ENTERPRISE=2 ENTERPRISE value + * @property {number} ENTERPRISE_PLUS=3 ENTERPRISE_PLUS value + */ + v1.Edition = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "EDITION_UNSPECIFIED"] = 0; + values[valuesById[1] = "STANDARD"] = 1; + values[valuesById[2] = "ENTERPRISE"] = 2; + values[valuesById[3] = "ENTERPRISE_PLUS"] = 3; + return values; + })(); + return v1; })(); diff --git a/packages/google-cloud-bigquery-reservation/protos/protos.json b/packages/google-cloud-bigquery-reservation/protos/protos.json index 12f24fa7e77..afb9fcc6b07 100644 --- a/packages/google-cloud-bigquery-reservation/protos/protos.json +++ b/packages/google-cloud-bigquery-reservation/protos/protos.json @@ -446,6 +446,10 @@ "type": "bool", "id": 4 }, + "autoscale": { + "type": "Autoscale", + "id": 7 + }, "concurrency": { "type": "int64", "id": 16 @@ -467,6 +471,27 @@ "multiRegionAuxiliary": { "type": "bool", "id": 14 + }, + "edition": { + "type": "Edition", + "id": 17 + } + }, + "nested": { + "Autoscale": { + "fields": { + "currentSlots": { + "type": "int64", + "id": 1, + "options": { + "(google.api.field_behavior)": "OUTPUT_ONLY" + } + }, + "maxSlots": { + "type": "int64", + "id": 2 + } + } } } }, @@ -526,6 +551,10 @@ "multiRegionAuxiliary": { "type": "bool", "id": 10 + }, + "edition": { + "type": "Edition", + "id": 12 } }, "nested": { @@ -533,9 +562,14 @@ "values": { "COMMITMENT_PLAN_UNSPECIFIED": 0, "FLEX": 3, + "FLEX_FLAT_RATE": 7, "TRIAL": 5, "MONTHLY": 2, - "ANNUAL": 4 + "MONTHLY_FLAT_RATE": 8, + "ANNUAL": 4, + "ANNUAL_FLAT_RATE": 9, + "THREE_YEAR": 10, + "NONE": 6 } }, "State": { @@ -813,7 +847,8 @@ "JOB_TYPE_UNSPECIFIED": 0, "PIPELINE": 1, "QUERY": 2, - "ML_EXTERNAL": 3 + "ML_EXTERNAL": 3, + "BACKGROUND": 4 } }, "State": { @@ -980,6 +1015,10 @@ "options": { "(google.api.resource_reference).child_type": "bigqueryreservation.googleapis.com/Assignment" } + }, + "assignmentId": { + "type": "string", + "id": 5 } } }, @@ -1062,6 +1101,14 @@ "id": 2 } } + }, + "Edition": { + "values": { + "EDITION_UNSPECIFIED": 0, + "STANDARD": 1, + "ENTERPRISE": 2, + "ENTERPRISE_PLUS": 3 + } } } } 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 index 509c847ccda..e276e921492 100644 --- 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 @@ -39,6 +39,13 @@ function main(name) { * `projects/myotherproject/locations/US/reservations/team2-prod` */ // const destinationId = 'abc123' + /** + * The optional assignment ID. A new assignment name is generated if this + * field is empty. + * This field can contain only lowercase alphanumeric characters or dashes. + * Max length is 64 characters. + */ + // const assignmentId = 'abc123' // Imports the Reservation library const {ReservationServiceClient} = require('@google-cloud/bigquery-reservation').v1; 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 index 1b1dd73f46d..167f612c31e 100644 --- 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 @@ -29,8 +29,8 @@ function main(parent) { * TODO(developer): Uncomment these variables before running the sample. */ /** - * Required. The resource name with location (project name could be the wildcard '-'), - * e.g.: + * Required. The resource name with location (project name could be the + * wildcard '-'), e.g.: * `projects/-/locations/US`. */ // const parent = 'abc123' 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 index ac51e9e98b6..69d2d047e6d 100644 --- 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 @@ -29,8 +29,8 @@ function main(parent) { * TODO(developer): Uncomment these variables before running the sample. */ /** - * Required. The resource name of the admin project(containing project and location), - * e.g.: + * Required. The resource name of the admin project(containing project and + * location), e.g.: * `projects/myproject/locations/US`. */ // const parent = 'abc123' diff --git a/packages/google-cloud-bigquery-reservation/samples/generated/v1/snippet_metadata.google.cloud.bigquery.reservation.v1.json b/packages/google-cloud-bigquery-reservation/samples/generated/v1/snippet_metadata.google.cloud.bigquery.reservation.v1.json index 426eafe0d71..9cea1526f6c 100644 --- a/packages/google-cloud-bigquery-reservation/samples/generated/v1/snippet_metadata.google.cloud.bigquery.reservation.v1.json +++ b/packages/google-cloud-bigquery-reservation/samples/generated/v1/snippet_metadata.google.cloud.bigquery.reservation.v1.json @@ -1,7 +1,7 @@ { "clientLibrary": { "name": "nodejs-reservation", - "version": "2.1.0", + "version": "2.1.1", "language": "TYPESCRIPT", "apis": [ { @@ -798,7 +798,7 @@ "segments": [ { "start": 25, - "end": 60, + "end": 67, "type": "FULL" } ], @@ -814,6 +814,10 @@ { "name": "destination_id", "type": "TYPE_STRING" + }, + { + "name": "assignment_id", + "type": "TYPE_STRING" } ], "resultType": ".google.cloud.bigquery.reservation.v1.Assignment", 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 75736b8eb28..c1f101c3d92 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 @@ -1722,6 +1722,12 @@ export class ReservationServiceClient { * @param {string} request.destinationId * The new reservation ID, e.g.: * `projects/myotherproject/locations/US/reservations/team2-prod` + * @param {string} request.assignmentId + * The optional assignment ID. A new assignment name is generated if this + * field is empty. + * + * This field can contain only lowercase alphanumeric characters or dashes. + * Max length is 64 characters. * @param {object} [options] * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. * @returns {Promise} - The promise which resolves to an array. @@ -2761,8 +2767,8 @@ export class ReservationServiceClient { * @param {Object} request * The request object that will be sent. * @param {string} request.parent - * Required. The resource name of the admin project(containing project and location), - * e.g.: + * Required. The resource name of the admin project(containing project and + * location), e.g.: * `projects/myproject/locations/US`. * @param {string} request.query * Please specify resource name as assignee in the query. @@ -2875,8 +2881,8 @@ export class ReservationServiceClient { * @param {Object} request * The request object that will be sent. * @param {string} request.parent - * Required. The resource name of the admin project(containing project and location), - * e.g.: + * Required. The resource name of the admin project(containing project and + * location), e.g.: * `projects/myproject/locations/US`. * @param {string} request.query * Please specify resource name as assignee in the query. @@ -2937,8 +2943,8 @@ export class ReservationServiceClient { * @param {Object} request * The request object that will be sent. * @param {string} request.parent - * Required. The resource name of the admin project(containing project and location), - * e.g.: + * Required. The resource name of the admin project(containing project and + * location), e.g.: * `projects/myproject/locations/US`. * @param {string} request.query * Please specify resource name as assignee in the query. @@ -3017,8 +3023,8 @@ export class ReservationServiceClient { * @param {Object} request * The request object that will be sent. * @param {string} request.parent - * Required. The resource name with location (project name could be the wildcard '-'), - * e.g.: + * Required. The resource name with location (project name could be the + * wildcard '-'), e.g.: * `projects/-/locations/US`. * @param {string} request.query * Please specify resource name as assignee in the query. @@ -3125,8 +3131,8 @@ export class ReservationServiceClient { * @param {Object} request * The request object that will be sent. * @param {string} request.parent - * Required. The resource name with location (project name could be the wildcard '-'), - * e.g.: + * Required. The resource name with location (project name could be the + * wildcard '-'), e.g.: * `projects/-/locations/US`. * @param {string} request.query * Please specify resource name as assignee in the query. @@ -3181,8 +3187,8 @@ export class ReservationServiceClient { * @param {Object} request * The request object that will be sent. * @param {string} request.parent - * Required. The resource name with location (project name could be the wildcard '-'), - * e.g.: + * Required. The resource name with location (project name could be the + * wildcard '-'), e.g.: * `projects/-/locations/US`. * @param {string} request.query * Please specify resource name as assignee in the query.