From be984979c8fb6cf1a2a24800cb5192634af9ddd3 Mon Sep 17 00:00:00 2001 From: Owl Bot Date: Fri, 24 Jun 2022 10:02:04 +0000 Subject: [PATCH 1/2] feat: support regapic LRO Use gapic-generator-typescript v2.15.1. PiperOrigin-RevId: 456946341 Source-Link: https://github.com/googleapis/googleapis/commit/88fd18d9d3b872b3d06a3d9392879f50b5bf3ce5 Source-Link: https://github.com/googleapis/googleapis-gen/commit/accfa371f667439313335c64042b063c1c53102e Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiYWNjZmEzNzFmNjY3NDM5MzEzMzM1YzY0MDQyYjA2M2MxYzUzMTAyZSJ9 --- owl-bot-staging/v1/.eslintignore | 7 + owl-bot-staging/v1/.eslintrc.json | 3 + owl-bot-staging/v1/.gitignore | 14 + owl-bot-staging/v1/.jsdoc.js | 55 ++ owl-bot-staging/v1/.mocharc.js | 33 ++ owl-bot-staging/v1/.prettierrc.js | 22 + owl-bot-staging/v1/README.md | 1 + owl-bot-staging/v1/linkinator.config.json | 16 + owl-bot-staging/v1/package.json | 65 +++ .../api/servicecontrol/v1/check_error.proto | 124 +++++ .../api/servicecontrol/v1/distribution.proto | 166 ++++++ .../api/servicecontrol/v1/http_request.proto | 93 ++++ .../api/servicecontrol/v1/log_entry.proto | 126 +++++ .../api/servicecontrol/v1/metric_value.proto | 81 +++ .../api/servicecontrol/v1/operation.proto | 123 +++++ .../servicecontrol/v1/quota_controller.proto | 245 +++++++++ .../v1/service_controller.proto | 256 +++++++++ .../google/logging/type/http_request.proto | 95 ++++ .../google/logging/type/log_severity.proto | 71 +++ .../v1/quota_controller.allocate_quota.js | 69 +++ .../generated/v1/service_controller.check.js | 72 +++ .../generated/v1/service_controller.report.js | 80 +++ ...metadata.google.api.servicecontrol.v1.json | 159 ++++++ owl-bot-staging/v1/src/index.ts | 27 + owl-bot-staging/v1/src/v1/gapic_metadata.json | 67 +++ owl-bot-staging/v1/src/v1/index.ts | 20 + .../v1/src/v1/quota_controller_client.ts | 386 +++++++++++++ .../v1/quota_controller_client_config.json | 30 ++ .../src/v1/quota_controller_proto_list.json | 11 + .../v1/src/v1/service_controller_client.ts | 504 +++++++++++++++++ .../v1/service_controller_client_config.json | 48 ++ .../src/v1/service_controller_proto_list.json | 11 + .../system-test/fixtures/sample/src/index.js | 28 + .../system-test/fixtures/sample/src/index.ts | 38 ++ owl-bot-staging/v1/system-test/install.ts | 49 ++ .../v1/test/gapic_quota_controller_v1.ts | 232 ++++++++ .../v1/test/gapic_service_controller_v1.ts | 329 ++++++++++++ owl-bot-staging/v1/tsconfig.json | 19 + owl-bot-staging/v1/webpack.config.js | 64 +++ owl-bot-staging/v2/.eslintignore | 7 + owl-bot-staging/v2/.eslintrc.json | 3 + owl-bot-staging/v2/.gitignore | 14 + owl-bot-staging/v2/.jsdoc.js | 55 ++ owl-bot-staging/v2/.mocharc.js | 33 ++ owl-bot-staging/v2/.prettierrc.js | 22 + owl-bot-staging/v2/README.md | 1 + owl-bot-staging/v2/linkinator.config.json | 16 + owl-bot-staging/v2/package.json | 64 +++ .../v2/service_controller.proto | 190 +++++++ .../generated/v2/service_controller.check.js | 79 +++ .../generated/v2/service_controller.report.js | 73 +++ ...metadata.google.api.servicecontrol.v2.json | 119 ++++ owl-bot-staging/v2/src/index.ts | 25 + owl-bot-staging/v2/src/v2/gapic_metadata.json | 43 ++ owl-bot-staging/v2/src/v2/index.ts | 19 + .../v2/src/v2/service_controller_client.ts | 508 ++++++++++++++++++ .../v2/service_controller_client_config.json | 47 ++ .../src/v2/service_controller_proto_list.json | 3 + .../system-test/fixtures/sample/src/index.js | 27 + .../system-test/fixtures/sample/src/index.ts | 32 ++ owl-bot-staging/v2/system-test/install.ts | 49 ++ .../v2/test/gapic_service_controller_v2.ts | 329 ++++++++++++ owl-bot-staging/v2/tsconfig.json | 19 + owl-bot-staging/v2/webpack.config.js | 64 +++ 64 files changed, 5680 insertions(+) create mode 100644 owl-bot-staging/v1/.eslintignore create mode 100644 owl-bot-staging/v1/.eslintrc.json create mode 100644 owl-bot-staging/v1/.gitignore create mode 100644 owl-bot-staging/v1/.jsdoc.js create mode 100644 owl-bot-staging/v1/.mocharc.js create mode 100644 owl-bot-staging/v1/.prettierrc.js create mode 100644 owl-bot-staging/v1/README.md create mode 100644 owl-bot-staging/v1/linkinator.config.json create mode 100644 owl-bot-staging/v1/package.json create mode 100644 owl-bot-staging/v1/protos/google/api/servicecontrol/v1/check_error.proto create mode 100644 owl-bot-staging/v1/protos/google/api/servicecontrol/v1/distribution.proto create mode 100644 owl-bot-staging/v1/protos/google/api/servicecontrol/v1/http_request.proto create mode 100644 owl-bot-staging/v1/protos/google/api/servicecontrol/v1/log_entry.proto create mode 100644 owl-bot-staging/v1/protos/google/api/servicecontrol/v1/metric_value.proto create mode 100644 owl-bot-staging/v1/protos/google/api/servicecontrol/v1/operation.proto create mode 100644 owl-bot-staging/v1/protos/google/api/servicecontrol/v1/quota_controller.proto create mode 100644 owl-bot-staging/v1/protos/google/api/servicecontrol/v1/service_controller.proto create mode 100644 owl-bot-staging/v1/protos/google/logging/type/http_request.proto create mode 100644 owl-bot-staging/v1/protos/google/logging/type/log_severity.proto create mode 100644 owl-bot-staging/v1/samples/generated/v1/quota_controller.allocate_quota.js create mode 100644 owl-bot-staging/v1/samples/generated/v1/service_controller.check.js create mode 100644 owl-bot-staging/v1/samples/generated/v1/service_controller.report.js create mode 100644 owl-bot-staging/v1/samples/generated/v1/snippet_metadata.google.api.servicecontrol.v1.json create mode 100644 owl-bot-staging/v1/src/index.ts create mode 100644 owl-bot-staging/v1/src/v1/gapic_metadata.json create mode 100644 owl-bot-staging/v1/src/v1/index.ts create mode 100644 owl-bot-staging/v1/src/v1/quota_controller_client.ts create mode 100644 owl-bot-staging/v1/src/v1/quota_controller_client_config.json create mode 100644 owl-bot-staging/v1/src/v1/quota_controller_proto_list.json create mode 100644 owl-bot-staging/v1/src/v1/service_controller_client.ts create mode 100644 owl-bot-staging/v1/src/v1/service_controller_client_config.json create mode 100644 owl-bot-staging/v1/src/v1/service_controller_proto_list.json create mode 100644 owl-bot-staging/v1/system-test/fixtures/sample/src/index.js create mode 100644 owl-bot-staging/v1/system-test/fixtures/sample/src/index.ts create mode 100644 owl-bot-staging/v1/system-test/install.ts create mode 100644 owl-bot-staging/v1/test/gapic_quota_controller_v1.ts create mode 100644 owl-bot-staging/v1/test/gapic_service_controller_v1.ts create mode 100644 owl-bot-staging/v1/tsconfig.json create mode 100644 owl-bot-staging/v1/webpack.config.js create mode 100644 owl-bot-staging/v2/.eslintignore create mode 100644 owl-bot-staging/v2/.eslintrc.json create mode 100644 owl-bot-staging/v2/.gitignore create mode 100644 owl-bot-staging/v2/.jsdoc.js create mode 100644 owl-bot-staging/v2/.mocharc.js create mode 100644 owl-bot-staging/v2/.prettierrc.js create mode 100644 owl-bot-staging/v2/README.md create mode 100644 owl-bot-staging/v2/linkinator.config.json create mode 100644 owl-bot-staging/v2/package.json create mode 100644 owl-bot-staging/v2/protos/google/api/servicecontrol/v2/service_controller.proto create mode 100644 owl-bot-staging/v2/samples/generated/v2/service_controller.check.js create mode 100644 owl-bot-staging/v2/samples/generated/v2/service_controller.report.js create mode 100644 owl-bot-staging/v2/samples/generated/v2/snippet_metadata.google.api.servicecontrol.v2.json create mode 100644 owl-bot-staging/v2/src/index.ts create mode 100644 owl-bot-staging/v2/src/v2/gapic_metadata.json create mode 100644 owl-bot-staging/v2/src/v2/index.ts create mode 100644 owl-bot-staging/v2/src/v2/service_controller_client.ts create mode 100644 owl-bot-staging/v2/src/v2/service_controller_client_config.json create mode 100644 owl-bot-staging/v2/src/v2/service_controller_proto_list.json create mode 100644 owl-bot-staging/v2/system-test/fixtures/sample/src/index.js create mode 100644 owl-bot-staging/v2/system-test/fixtures/sample/src/index.ts create mode 100644 owl-bot-staging/v2/system-test/install.ts create mode 100644 owl-bot-staging/v2/test/gapic_service_controller_v2.ts create mode 100644 owl-bot-staging/v2/tsconfig.json create mode 100644 owl-bot-staging/v2/webpack.config.js diff --git a/owl-bot-staging/v1/.eslintignore b/owl-bot-staging/v1/.eslintignore new file mode 100644 index 0000000..cfc348e --- /dev/null +++ b/owl-bot-staging/v1/.eslintignore @@ -0,0 +1,7 @@ +**/node_modules +**/.coverage +build/ +docs/ +protos/ +system-test/ +samples/generated/ diff --git a/owl-bot-staging/v1/.eslintrc.json b/owl-bot-staging/v1/.eslintrc.json new file mode 100644 index 0000000..7821534 --- /dev/null +++ b/owl-bot-staging/v1/.eslintrc.json @@ -0,0 +1,3 @@ +{ + "extends": "./node_modules/gts" +} diff --git a/owl-bot-staging/v1/.gitignore b/owl-bot-staging/v1/.gitignore new file mode 100644 index 0000000..5d32b23 --- /dev/null +++ b/owl-bot-staging/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/v1/.jsdoc.js b/owl-bot-staging/v1/.jsdoc.js new file mode 100644 index 0000000..87ec09c --- /dev/null +++ b/owl-bot-staging/v1/.jsdoc.js @@ -0,0 +1,55 @@ +// Copyright 2022 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 2022 Google LLC', + includeDate: false, + sourceFiles: false, + systemName: '@google-cloud/service-control', + theme: 'lumen', + default: { + outputSourceFiles: false + } + }, + markdown: { + idInHeadings: true + } +}; diff --git a/owl-bot-staging/v1/.mocharc.js b/owl-bot-staging/v1/.mocharc.js new file mode 100644 index 0000000..481c522 --- /dev/null +++ b/owl-bot-staging/v1/.mocharc.js @@ -0,0 +1,33 @@ +// Copyright 2022 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/v1/.prettierrc.js b/owl-bot-staging/v1/.prettierrc.js new file mode 100644 index 0000000..494e147 --- /dev/null +++ b/owl-bot-staging/v1/.prettierrc.js @@ -0,0 +1,22 @@ +// Copyright 2022 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/v1/README.md b/owl-bot-staging/v1/README.md new file mode 100644 index 0000000..369bd39 --- /dev/null +++ b/owl-bot-staging/v1/README.md @@ -0,0 +1 @@ +Servicecontrol: Nodejs Client diff --git a/owl-bot-staging/v1/linkinator.config.json b/owl-bot-staging/v1/linkinator.config.json new file mode 100644 index 0000000..befd23c --- /dev/null +++ b/owl-bot-staging/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/v1/package.json b/owl-bot-staging/v1/package.json new file mode 100644 index 0000000..bd2371a --- /dev/null +++ b/owl-bot-staging/v1/package.json @@ -0,0 +1,65 @@ +{ + "name": "@google-cloud/service-control", + "version": "0.1.0", + "description": "Servicecontrol client for Node.js", + "repository": "googleapis/nodejs-servicecontrol", + "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 servicecontrol", + "servicecontrol", + "quota controller", + "service controller" + ], + "scripts": { + "clean": "gts clean", + "compile": "tsc -p . && cp -r protos build/", + "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.1.1" + }, + "devDependencies": { + "@types/mocha": "^9.1.0", + "@types/node": "^16.0.0", + "@types/sinon": "^10.0.8", + "c8": "^7.11.0", + "gts": "^3.1.0", + "jsdoc": "^3.6.7", + "jsdoc-fresh": "^1.1.1", + "jsdoc-region-tag": "^1.3.1", + "linkinator": "^3.0.0", + "mocha": "^9.1.4", + "null-loader": "^4.0.1", + "pack-n-play": "^1.0.0-2", + "sinon": "^13.0.0", + "ts-loader": "^9.2.6", + "typescript": "^4.5.5", + "webpack": "^5.67.0", + "webpack-cli": "^4.9.1" + }, + "engines": { + "node": ">=v12" + } +} diff --git a/owl-bot-staging/v1/protos/google/api/servicecontrol/v1/check_error.proto b/owl-bot-staging/v1/protos/google/api/servicecontrol/v1/check_error.proto new file mode 100644 index 0000000..4f63471 --- /dev/null +++ b/owl-bot-staging/v1/protos/google/api/servicecontrol/v1/check_error.proto @@ -0,0 +1,124 @@ +// Copyright 2021 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +syntax = "proto3"; + +package google.api.servicecontrol.v1; + +import "google/rpc/status.proto"; + +option cc_enable_arenas = true; +option csharp_namespace = "Google.Cloud.ServiceControl.V1"; +option go_package = "google.golang.org/genproto/googleapis/api/servicecontrol/v1;servicecontrol"; +option java_multiple_files = true; +option java_outer_classname = "CheckErrorProto"; +option java_package = "com.google.api.servicecontrol.v1"; +option php_namespace = "Google\\Cloud\\ServiceControl\\V1"; +option ruby_package = "Google::Cloud::ServiceControl::V1"; + +// Defines the errors to be returned in +// [google.api.servicecontrol.v1.CheckResponse.check_errors][google.api.servicecontrol.v1.CheckResponse.check_errors]. +message CheckError { + // Error codes for Check responses. + enum Code { + // This is never used in `CheckResponse`. + ERROR_CODE_UNSPECIFIED = 0; + + // The consumer's project id, network container, or resource container was + // not found. Same as [google.rpc.Code.NOT_FOUND][google.rpc.Code.NOT_FOUND]. + NOT_FOUND = 5; + + // The consumer doesn't have access to the specified resource. + // Same as [google.rpc.Code.PERMISSION_DENIED][google.rpc.Code.PERMISSION_DENIED]. + PERMISSION_DENIED = 7; + + // Quota check failed. Same as [google.rpc.Code.RESOURCE_EXHAUSTED][google.rpc.Code.RESOURCE_EXHAUSTED]. + RESOURCE_EXHAUSTED = 8; + + // The consumer hasn't activated the service. + SERVICE_NOT_ACTIVATED = 104; + + // The consumer cannot access the service because billing is disabled. + BILLING_DISABLED = 107; + + // The consumer's project has been marked as deleted (soft deletion). + PROJECT_DELETED = 108; + + // The consumer's project number or id does not represent a valid project. + PROJECT_INVALID = 114; + + // The input consumer info does not represent a valid consumer folder or + // organization. + CONSUMER_INVALID = 125; + + // The IP address of the consumer is invalid for the specific consumer + // project. + IP_ADDRESS_BLOCKED = 109; + + // The referer address of the consumer request is invalid for the specific + // consumer project. + REFERER_BLOCKED = 110; + + // The client application of the consumer request is invalid for the + // specific consumer project. + CLIENT_APP_BLOCKED = 111; + + // The API targeted by this request is invalid for the specified consumer + // project. + API_TARGET_BLOCKED = 122; + + // The consumer's API key is invalid. + API_KEY_INVALID = 105; + + // The consumer's API Key has expired. + API_KEY_EXPIRED = 112; + + // The consumer's API Key was not found in config record. + API_KEY_NOT_FOUND = 113; + + // The credential in the request can not be verified. + INVALID_CREDENTIAL = 123; + + // The backend server for looking up project id/number is unavailable. + NAMESPACE_LOOKUP_UNAVAILABLE = 300; + + // The backend server for checking service status is unavailable. + SERVICE_STATUS_UNAVAILABLE = 301; + + // The backend server for checking billing status is unavailable. + BILLING_STATUS_UNAVAILABLE = 302; + + // Cloud Resource Manager backend server is unavailable. + CLOUD_RESOURCE_MANAGER_BACKEND_UNAVAILABLE = 305; + } + + // The error code. + Code code = 1; + + // Subject to whom this error applies. See the specific code enum for more + // details on this field. For example: + // + // - "project:" + // - "folder:" + // - "organization:" + string subject = 4; + + // Free-form text providing details on the error cause of the error. + string detail = 2; + + // Contains public information about the check error. If available, + // `status.code` will be non zero and client can propagate it out as public + // error. + google.rpc.Status status = 3; +} diff --git a/owl-bot-staging/v1/protos/google/api/servicecontrol/v1/distribution.proto b/owl-bot-staging/v1/protos/google/api/servicecontrol/v1/distribution.proto new file mode 100644 index 0000000..e874e44 --- /dev/null +++ b/owl-bot-staging/v1/protos/google/api/servicecontrol/v1/distribution.proto @@ -0,0 +1,166 @@ +// Copyright 2021 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +syntax = "proto3"; + +package google.api.servicecontrol.v1; + +import "google/api/distribution.proto"; + +option cc_enable_arenas = true; +option csharp_namespace = "Google.Cloud.ServiceControl.V1"; +option go_package = "google.golang.org/genproto/googleapis/api/servicecontrol/v1;servicecontrol"; +option java_multiple_files = true; +option java_outer_classname = "DistributionProto"; +option java_package = "com.google.api.servicecontrol.v1"; +option php_namespace = "Google\\Cloud\\ServiceControl\\V1"; +option ruby_package = "Google::Cloud::ServiceControl::V1"; + +// Distribution represents a frequency distribution of double-valued sample +// points. It contains the size of the population of sample points plus +// additional optional information: +// +// * the arithmetic mean of the samples +// * the minimum and maximum of the samples +// * the sum-squared-deviation of the samples, used to compute variance +// * a histogram of the values of the sample points +message Distribution { + // Describing buckets with constant width. + message LinearBuckets { + // The number of finite buckets. With the underflow and overflow buckets, + // the total number of buckets is `num_finite_buckets` + 2. + // See comments on `bucket_options` for details. + int32 num_finite_buckets = 1; + + // The i'th linear bucket covers the interval + // [offset + (i-1) * width, offset + i * width) + // where i ranges from 1 to num_finite_buckets, inclusive. + // Must be strictly positive. + double width = 2; + + // The i'th linear bucket covers the interval + // [offset + (i-1) * width, offset + i * width) + // where i ranges from 1 to num_finite_buckets, inclusive. + double offset = 3; + } + + // Describing buckets with exponentially growing width. + message ExponentialBuckets { + // The number of finite buckets. With the underflow and overflow buckets, + // the total number of buckets is `num_finite_buckets` + 2. + // See comments on `bucket_options` for details. + int32 num_finite_buckets = 1; + + // The i'th exponential bucket covers the interval + // [scale * growth_factor^(i-1), scale * growth_factor^i) + // where i ranges from 1 to num_finite_buckets inclusive. + // Must be larger than 1.0. + double growth_factor = 2; + + // The i'th exponential bucket covers the interval + // [scale * growth_factor^(i-1), scale * growth_factor^i) + // where i ranges from 1 to num_finite_buckets inclusive. + // Must be > 0. + double scale = 3; + } + + // Describing buckets with arbitrary user-provided width. + message ExplicitBuckets { + // 'bound' is a list of strictly increasing boundaries between + // buckets. Note that a list of length N-1 defines N buckets because + // of fenceposting. See comments on `bucket_options` for details. + // + // The i'th finite bucket covers the interval + // [bound[i-1], bound[i]) + // where i ranges from 1 to bound_size() - 1. Note that there are no + // finite buckets at all if 'bound' only contains a single element; in + // that special case the single bound defines the boundary between the + // underflow and overflow buckets. + // + // bucket number lower bound upper bound + // i == 0 (underflow) -inf bound[i] + // 0 < i < bound_size() bound[i-1] bound[i] + // i == bound_size() (overflow) bound[i-1] +inf + repeated double bounds = 1; + } + + // The total number of samples in the distribution. Must be >= 0. + int64 count = 1; + + // The arithmetic mean of the samples in the distribution. If `count` is + // zero then this field must be zero. + double mean = 2; + + // The minimum of the population of values. Ignored if `count` is zero. + double minimum = 3; + + // The maximum of the population of values. Ignored if `count` is zero. + double maximum = 4; + + // The sum of squared deviations from the mean: + // Sum[i=1..count]((x_i - mean)^2) + // where each x_i is a sample values. If `count` is zero then this field + // must be zero, otherwise validation of the request fails. + double sum_of_squared_deviation = 5; + + // The number of samples in each histogram bucket. `bucket_counts` are + // optional. If present, they must sum to the `count` value. + // + // The buckets are defined below in `bucket_option`. There are N buckets. + // `bucket_counts[0]` is the number of samples in the underflow bucket. + // `bucket_counts[1]` to `bucket_counts[N-1]` are the numbers of samples + // in each of the finite buckets. And `bucket_counts[N] is the number + // of samples in the overflow bucket. See the comments of `bucket_option` + // below for more details. + // + // Any suffix of trailing zeros may be omitted. + repeated int64 bucket_counts = 6; + + // Defines the buckets in the histogram. `bucket_option` and `bucket_counts` + // must be both set, or both unset. + // + // Buckets are numbered in the range of [0, N], with a total of N+1 buckets. + // There must be at least two buckets (a single-bucket histogram gives + // no information that isn't already provided by `count`). + // + // The first bucket is the underflow bucket which has a lower bound + // of -inf. The last bucket is the overflow bucket which has an + // upper bound of +inf. All other buckets (if any) are called "finite" + // buckets because they have finite lower and upper bounds. As described + // below, there are three ways to define the finite buckets. + // + // (1) Buckets with constant width. + // (2) Buckets with exponentially growing widths. + // (3) Buckets with arbitrary user-provided widths. + // + // In all cases, the buckets cover the entire real number line (-inf, + // +inf). Bucket upper bounds are exclusive and lower bounds are + // inclusive. The upper bound of the underflow bucket is equal to the + // lower bound of the smallest finite bucket; the lower bound of the + // overflow bucket is equal to the upper bound of the largest finite + // bucket. + oneof bucket_option { + // Buckets with constant width. + LinearBuckets linear_buckets = 7; + + // Buckets with exponentially growing width. + ExponentialBuckets exponential_buckets = 8; + + // Buckets with arbitrary user-provided width. + ExplicitBuckets explicit_buckets = 9; + } + + // Example points. Must be in increasing order of `value` field. + repeated google.api.Distribution.Exemplar exemplars = 10; +} diff --git a/owl-bot-staging/v1/protos/google/api/servicecontrol/v1/http_request.proto b/owl-bot-staging/v1/protos/google/api/servicecontrol/v1/http_request.proto new file mode 100644 index 0000000..1587203 --- /dev/null +++ b/owl-bot-staging/v1/protos/google/api/servicecontrol/v1/http_request.proto @@ -0,0 +1,93 @@ +// Copyright 2021 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +syntax = "proto3"; + +package google.api.servicecontrol.v1; + +import "google/protobuf/duration.proto"; + +option csharp_namespace = "Google.Cloud.ServiceControl.V1"; +option go_package = "google.golang.org/genproto/googleapis/api/servicecontrol/v1;servicecontrol"; +option java_multiple_files = true; +option java_outer_classname = "HttpRequestProto"; +option java_package = "com.google.api.servicecontrol.v1"; +option php_namespace = "Google\\Cloud\\ServiceControl\\V1"; +option ruby_package = "Google::Cloud::ServiceControl::V1"; + +// A common proto for logging HTTP requests. Only contains semantics +// defined by the HTTP specification. Product-specific logging +// information MUST be defined in a separate message. +message HttpRequest { + // The request method. Examples: `"GET"`, `"HEAD"`, `"PUT"`, `"POST"`. + string request_method = 1; + + // The scheme (http, https), the host name, the path, and the query + // portion of the URL that was requested. + // Example: `"http://example.com/some/info?color=red"`. + string request_url = 2; + + // The size of the HTTP request message in bytes, including the request + // headers and the request body. + int64 request_size = 3; + + // The response code indicating the status of the response. + // Examples: 200, 404. + int32 status = 4; + + // The size of the HTTP response message sent back to the client, in bytes, + // including the response headers and the response body. + int64 response_size = 5; + + // The user agent sent by the client. Example: + // `"Mozilla/4.0 (compatible; MSIE 6.0; Windows 98; Q312461; .NET + // CLR 1.0.3705)"`. + string user_agent = 6; + + // The IP address (IPv4 or IPv6) of the client that issued the HTTP + // request. Examples: `"192.168.1.1"`, `"FE80::0202:B3FF:FE1E:8329"`. + string remote_ip = 7; + + // The IP address (IPv4 or IPv6) of the origin server that the request was + // sent to. + string server_ip = 13; + + // The referer URL of the request, as defined in + // [HTTP/1.1 Header Field + // Definitions](http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html). + string referer = 8; + + // The request processing latency on the server, from the time the request was + // received until the response was sent. + google.protobuf.Duration latency = 14; + + // Whether or not a cache lookup was attempted. + bool cache_lookup = 11; + + // Whether or not an entity was served from cache + // (with or without validation). + bool cache_hit = 9; + + // Whether or not the response was validated with the origin server before + // being served from cache. This field is only meaningful if `cache_hit` is + // True. + bool cache_validated_with_origin_server = 10; + + // The number of HTTP response bytes inserted into cache. Set only when a + // cache fill was attempted. + int64 cache_fill_bytes = 12; + + // Protocol used for the request. Examples: "HTTP/1.1", "HTTP/2", "websocket" + string protocol = 15; +} diff --git a/owl-bot-staging/v1/protos/google/api/servicecontrol/v1/log_entry.proto b/owl-bot-staging/v1/protos/google/api/servicecontrol/v1/log_entry.proto new file mode 100644 index 0000000..4f20aef --- /dev/null +++ b/owl-bot-staging/v1/protos/google/api/servicecontrol/v1/log_entry.proto @@ -0,0 +1,126 @@ +// Copyright 2021 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +syntax = "proto3"; + +package google.api.servicecontrol.v1; + +import "google/api/servicecontrol/v1/http_request.proto"; +import "google/logging/type/log_severity.proto"; +import "google/protobuf/any.proto"; +import "google/protobuf/struct.proto"; +import "google/protobuf/timestamp.proto"; + +option csharp_namespace = "Google.Cloud.ServiceControl.V1"; +option go_package = "google.golang.org/genproto/googleapis/api/servicecontrol/v1;servicecontrol"; +option java_multiple_files = true; +option java_outer_classname = "LogEntryProto"; +option java_package = "com.google.api.servicecontrol.v1"; +option php_namespace = "Google\\Cloud\\ServiceControl\\V1"; +option ruby_package = "Google::Cloud::ServiceControl::V1"; + +// An individual log entry. +message LogEntry { + // Required. The log to which this log entry belongs. Examples: `"syslog"`, + // `"book_log"`. + string name = 10; + + // The time the event described by the log entry occurred. If + // omitted, defaults to operation start time. + google.protobuf.Timestamp timestamp = 11; + + // The severity of the log entry. The default value is + // `LogSeverity.DEFAULT`. + google.logging.type.LogSeverity severity = 12; + + // Optional. Information about the HTTP request associated with this + // log entry, if applicable. + HttpRequest http_request = 14; + + // Optional. Resource name of the trace associated with the log entry, if any. + // If this field contains a relative resource name, you can assume the name is + // relative to `//tracing.googleapis.com`. Example: + // `projects/my-projectid/traces/06796866738c859f2f19b7cfb3214824` + string trace = 15; + + // A unique ID for the log entry used for deduplication. If omitted, + // the implementation will generate one based on operation_id. + string insert_id = 4; + + // A set of user-defined (key, value) data that provides additional + // information about the log entry. + map labels = 13; + + // The log entry payload, which can be one of multiple types. + oneof payload { + // The log entry payload, represented as a protocol buffer that is + // expressed as a JSON object. The only accepted type currently is + // [AuditLog][google.cloud.audit.AuditLog]. + google.protobuf.Any proto_payload = 2; + + // The log entry payload, represented as a Unicode string (UTF-8). + string text_payload = 3; + + // The log entry payload, represented as a structure that + // is expressed as a JSON object. + google.protobuf.Struct struct_payload = 6; + } + + // Optional. Information about an operation associated with the log entry, if + // applicable. + LogEntryOperation operation = 16; + + // Optional. Source code location information associated with the log entry, + // if any. + LogEntrySourceLocation source_location = 17; +} + +// Additional information about a potentially long-running operation with which +// a log entry is associated. +message LogEntryOperation { + // Optional. An arbitrary operation identifier. Log entries with the + // same identifier are assumed to be part of the same operation. + string id = 1; + + // Optional. An arbitrary producer identifier. The combination of + // `id` and `producer` must be globally unique. Examples for `producer`: + // `"MyDivision.MyBigCompany.com"`, `"github.com/MyProject/MyApplication"`. + string producer = 2; + + // Optional. Set this to True if this is the first log entry in the operation. + bool first = 3; + + // Optional. Set this to True if this is the last log entry in the operation. + bool last = 4; +} + +// Additional information about the source code location that produced the log +// entry. +message LogEntrySourceLocation { + // Optional. Source file name. Depending on the runtime environment, this + // might be a simple name or a fully-qualified name. + string file = 1; + + // Optional. Line within the source file. 1-based; 0 indicates no line number + // available. + int64 line = 2; + + // Optional. Human-readable name of the function or method being invoked, with + // optional context such as the class or package name. This information may be + // used in contexts such as the logs viewer, where a file and line number are + // less meaningful. The format can vary by language. For example: + // `qual.if.ied.Class.method` (Java), `dir/package.func` (Go), `function` + // (Python). + string function = 3; +} diff --git a/owl-bot-staging/v1/protos/google/api/servicecontrol/v1/metric_value.proto b/owl-bot-staging/v1/protos/google/api/servicecontrol/v1/metric_value.proto new file mode 100644 index 0000000..c0e2a42 --- /dev/null +++ b/owl-bot-staging/v1/protos/google/api/servicecontrol/v1/metric_value.proto @@ -0,0 +1,81 @@ +// Copyright 2021 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +syntax = "proto3"; + +package google.api.servicecontrol.v1; + +import "google/api/servicecontrol/v1/distribution.proto"; +import "google/protobuf/timestamp.proto"; + +option cc_enable_arenas = true; +option csharp_namespace = "Google.Cloud.ServiceControl.V1"; +option go_package = "google.golang.org/genproto/googleapis/api/servicecontrol/v1;servicecontrol"; +option java_multiple_files = true; +option java_outer_classname = "MetricValueSetProto"; +option java_package = "com.google.api.servicecontrol.v1"; +option php_namespace = "Google\\Cloud\\ServiceControl\\V1"; +option ruby_package = "Google::Cloud::ServiceControl::V1"; + +// Represents a single metric value. +message MetricValue { + // The labels describing the metric value. + // See comments on [google.api.servicecontrol.v1.Operation.labels][google.api.servicecontrol.v1.Operation.labels] for + // the overriding relationship. + // Note that this map must not contain monitored resource labels. + map labels = 1; + + // The start of the time period over which this metric value's measurement + // applies. The time period has different semantics for different metric + // types (cumulative, delta, and gauge). See the metric definition + // documentation in the service configuration for details. If not specified, + // [google.api.servicecontrol.v1.Operation.start_time][google.api.servicecontrol.v1.Operation.start_time] will be used. + google.protobuf.Timestamp start_time = 2; + + // The end of the time period over which this metric value's measurement + // applies. If not specified, + // [google.api.servicecontrol.v1.Operation.end_time][google.api.servicecontrol.v1.Operation.end_time] will be used. + google.protobuf.Timestamp end_time = 3; + + // The value. The type of value used in the request must + // agree with the metric definition in the service configuration, otherwise + // the MetricValue is rejected. + oneof value { + // A boolean value. + bool bool_value = 4; + + // A signed 64-bit integer value. + int64 int64_value = 5; + + // A double precision floating point value. + double double_value = 6; + + // A text string value. + string string_value = 7; + + // A distribution value. + Distribution distribution_value = 8; + } +} + +// Represents a set of metric values in the same metric. +// Each metric value in the set should have a unique combination of start time, +// end time, and label values. +message MetricValueSet { + // The metric name defined in the service configuration. + string metric_name = 1; + + // The values in this metric. + repeated MetricValue metric_values = 2; +} diff --git a/owl-bot-staging/v1/protos/google/api/servicecontrol/v1/operation.proto b/owl-bot-staging/v1/protos/google/api/servicecontrol/v1/operation.proto new file mode 100644 index 0000000..7ce6cd4 --- /dev/null +++ b/owl-bot-staging/v1/protos/google/api/servicecontrol/v1/operation.proto @@ -0,0 +1,123 @@ +// Copyright 2021 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +syntax = "proto3"; + +package google.api.servicecontrol.v1; + +import "google/api/servicecontrol/v1/log_entry.proto"; +import "google/api/servicecontrol/v1/metric_value.proto"; +import "google/protobuf/any.proto"; +import "google/protobuf/timestamp.proto"; + +option cc_enable_arenas = true; +option csharp_namespace = "Google.Cloud.ServiceControl.V1"; +option go_package = "google.golang.org/genproto/googleapis/api/servicecontrol/v1;servicecontrol"; +option java_multiple_files = true; +option java_outer_classname = "OperationProto"; +option java_package = "com.google.api.servicecontrol.v1"; +option php_namespace = "Google\\Cloud\\ServiceControl\\V1"; +option ruby_package = "Google::Cloud::ServiceControl::V1"; + +// Represents information regarding an operation. +message Operation { + // Defines the importance of the data contained in the operation. + enum Importance { + // Allows data caching, batching, and aggregation. It provides + // higher performance with higher data loss risk. + LOW = 0; + + // Disables data aggregation to minimize data loss. It is for operations + // that contains significant monetary value or audit trail. This feature + // only applies to the client libraries. + HIGH = 1; + } + + // Identity of the operation. This must be unique within the scope of the + // service that generated the operation. If the service calls + // Check() and Report() on the same operation, the two calls should carry + // the same id. + // + // UUID version 4 is recommended, though not required. + // In scenarios where an operation is computed from existing information + // and an idempotent id is desirable for deduplication purpose, UUID version 5 + // is recommended. See RFC 4122 for details. + string operation_id = 1; + + // Fully qualified name of the operation. Reserved for future use. + string operation_name = 2; + + // Identity of the consumer who is using the service. + // This field should be filled in for the operations initiated by a + // consumer, but not for service-initiated operations that are + // not related to a specific consumer. + // + // - This can be in one of the following formats: + // - project:PROJECT_ID, + // - project`_`number:PROJECT_NUMBER, + // - projects/PROJECT_ID or PROJECT_NUMBER, + // - folders/FOLDER_NUMBER, + // - organizations/ORGANIZATION_NUMBER, + // - api`_`key:API_KEY. + string consumer_id = 3; + + // Required. Start time of the operation. + google.protobuf.Timestamp start_time = 4; + + // End time of the operation. + // Required when the operation is used in + // [ServiceController.Report][google.api.servicecontrol.v1.ServiceController.Report], + // but optional when the operation is used in + // [ServiceController.Check][google.api.servicecontrol.v1.ServiceController.Check]. + google.protobuf.Timestamp end_time = 5; + + // Labels describing the operation. Only the following labels are allowed: + // + // - Labels describing monitored resources as defined in + // the service configuration. + // - Default labels of metric values. When specified, labels defined in the + // metric value override these default. + // - The following labels defined by Google Cloud Platform: + // - `cloud.googleapis.com/location` describing the location where the + // operation happened, + // - `servicecontrol.googleapis.com/user_agent` describing the user agent + // of the API request, + // - `servicecontrol.googleapis.com/service_agent` describing the service + // used to handle the API request (e.g. ESP), + // - `servicecontrol.googleapis.com/platform` describing the platform + // where the API is served, such as App Engine, Compute Engine, or + // Kubernetes Engine. + map labels = 6; + + // Represents information about this operation. Each MetricValueSet + // corresponds to a metric defined in the service configuration. + // The data type used in the MetricValueSet must agree with + // the data type specified in the metric definition. + // + // Within a single operation, it is not allowed to have more than one + // MetricValue instances that have the same metric names and identical + // label value combinations. If a request has such duplicated MetricValue + // instances, the entire request is rejected with + // an invalid argument error. + repeated MetricValueSet metric_value_sets = 7; + + // Represents information to be logged. + repeated LogEntry log_entries = 8; + + // DO NOT USE. This is an experimental field. + Importance importance = 11; + + // Unimplemented. + repeated google.protobuf.Any extensions = 16; +} diff --git a/owl-bot-staging/v1/protos/google/api/servicecontrol/v1/quota_controller.proto b/owl-bot-staging/v1/protos/google/api/servicecontrol/v1/quota_controller.proto new file mode 100644 index 0000000..58b13ee --- /dev/null +++ b/owl-bot-staging/v1/protos/google/api/servicecontrol/v1/quota_controller.proto @@ -0,0 +1,245 @@ +// Copyright 2021 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +syntax = "proto3"; + +package google.api.servicecontrol.v1; + +import "google/api/annotations.proto"; +import "google/api/servicecontrol/v1/metric_value.proto"; +import "google/rpc/status.proto"; +import "google/api/client.proto"; + +option cc_enable_arenas = true; +option csharp_namespace = "Google.Cloud.ServiceControl.V1"; +option go_package = "google.golang.org/genproto/googleapis/api/servicecontrol/v1;servicecontrol"; +option java_multiple_files = true; +option java_outer_classname = "QuotaControllerProto"; +option java_package = "com.google.api.servicecontrol.v1"; +option php_namespace = "Google\\Cloud\\ServiceControl\\V1"; +option ruby_package = "Google::Cloud::ServiceControl::V1"; + +// [Google Quota Control API](/service-control/overview) +// +// Allows clients to allocate and release quota against a [managed +// service](https://cloud.google.com/service-management/reference/rpc/google.api/servicemanagement.v1#google.api.servicemanagement.v1.ManagedService). +service QuotaController { + option (google.api.default_host) = "servicecontrol.googleapis.com"; + option (google.api.oauth_scopes) = + "https://www.googleapis.com/auth/cloud-platform," + "https://www.googleapis.com/auth/servicecontrol"; + + // Attempts to allocate quota for the specified consumer. It should be called + // before the operation is executed. + // + // This method requires the `servicemanagement.services.quota` + // permission on the specified service. For more information, see + // [Cloud IAM](https://cloud.google.com/iam). + // + // **NOTE:** The client **must** fail-open on server errors `INTERNAL`, + // `UNKNOWN`, `DEADLINE_EXCEEDED`, and `UNAVAILABLE`. To ensure system + // reliability, the server may inject these errors to prohibit any hard + // dependency on the quota functionality. + rpc AllocateQuota(AllocateQuotaRequest) returns (AllocateQuotaResponse) { + option (google.api.http) = { + post: "/v1/services/{service_name}:allocateQuota" + body: "*" + }; + } +} + +// Request message for the AllocateQuota method. +message AllocateQuotaRequest { + // Name of the service as specified in the service configuration. For example, + // `"pubsub.googleapis.com"`. + // + // See [google.api.Service][google.api.Service] for the definition of a service name. + string service_name = 1; + + // Operation that describes the quota allocation. + QuotaOperation allocate_operation = 2; + + // Specifies which version of service configuration should be used to process + // the request. If unspecified or no matching version can be found, the latest + // one will be used. + string service_config_id = 4; +} + +// Represents information regarding a quota operation. +message QuotaOperation { + // Supported quota modes. + enum QuotaMode { + // Guard against implicit default. Must not be used. + UNSPECIFIED = 0; + + // For AllocateQuota request, allocates quota for the amount specified in + // the service configuration or specified using the quota metrics. If the + // amount is higher than the available quota, allocation error will be + // returned and no quota will be allocated. + // If multiple quotas are part of the request, and one fails, none of the + // quotas are allocated or released. + NORMAL = 1; + + // The operation allocates quota for the amount specified in the service + // configuration or specified using the quota metrics. If the amount is + // higher than the available quota, request does not fail but all available + // quota will be allocated. + // For rate quota, BEST_EFFORT will continue to deduct from other groups + // even if one does not have enough quota. For allocation, it will find the + // minimum available amount across all groups and deduct that amount from + // all the affected groups. + BEST_EFFORT = 2; + + // For AllocateQuota request, only checks if there is enough quota + // available and does not change the available quota. No lock is placed on + // the available quota either. + CHECK_ONLY = 3; + + // Unimplemented. When used in AllocateQuotaRequest, this returns the + // effective quota limit(s) in the response, and no quota check will be + // performed. Not supported for other requests, and even for + // AllocateQuotaRequest, this is currently supported only for allowlisted + // services. + QUERY_ONLY = 4; + + // The operation allocates quota for the amount specified in the service + // configuration or specified using the quota metrics. If the requested + // amount is higher than the available quota, request does not fail and + // remaining quota would become negative (going over the limit). + // Not supported for Rate Quota. + ADJUST_ONLY = 5; + } + + // Identity of the operation. This is expected to be unique within the scope + // of the service that generated the operation, and guarantees idempotency in + // case of retries. + // + // In order to ensure best performance and latency in the Quota backends, + // operation_ids are optimally associated with time, so that related + // operations can be accessed fast in storage. For this reason, the + // recommended token for services that intend to operate at a high QPS is + // Unix time in nanos + UUID + string operation_id = 1; + + // Fully qualified name of the API method for which this quota operation is + // requested. This name is used for matching quota rules or metric rules and + // billing status rules defined in service configuration. + // + // This field should not be set if any of the following is true: + // (1) the quota operation is performed on non-API resources. + // (2) quota_metrics is set because the caller is doing quota override. + // + // + // Example of an RPC method name: + // google.example.library.v1.LibraryService.CreateShelf + string method_name = 2; + + // Identity of the consumer for whom this quota operation is being performed. + // + // This can be in one of the following formats: + // project:, + // project_number:, + // api_key:. + string consumer_id = 3; + + // Labels describing the operation. + map labels = 4; + + // Represents information about this operation. Each MetricValueSet + // corresponds to a metric defined in the service configuration. + // The data type used in the MetricValueSet must agree with + // the data type specified in the metric definition. + // + // Within a single operation, it is not allowed to have more than one + // MetricValue instances that have the same metric names and identical + // label value combinations. If a request has such duplicated MetricValue + // instances, the entire request is rejected with + // an invalid argument error. + // + // This field is mutually exclusive with method_name. + repeated MetricValueSet quota_metrics = 5; + + // Quota mode for this operation. + QuotaMode quota_mode = 6; +} + +// Response message for the AllocateQuota method. +message AllocateQuotaResponse { + // The same operation_id value used in the AllocateQuotaRequest. Used for + // logging and diagnostics purposes. + string operation_id = 1; + + // Indicates the decision of the allocate. + repeated QuotaError allocate_errors = 2; + + // Quota metrics to indicate the result of allocation. Depending on the + // request, one or more of the following metrics will be included: + // + // 1. Per quota group or per quota metric incremental usage will be specified + // using the following delta metric : + // "serviceruntime.googleapis.com/api/consumer/quota_used_count" + // + // 2. The quota limit reached condition will be specified using the following + // boolean metric : + // "serviceruntime.googleapis.com/quota/exceeded" + repeated MetricValueSet quota_metrics = 3; + + // ID of the actual config used to process the request. + string service_config_id = 4; +} + +// Represents error information for [QuotaOperation][google.api.servicecontrol.v1.QuotaOperation]. +message QuotaError { + // Error codes related to project config validations are deprecated since the + // quota controller methods do not perform these validations. Instead services + // have to call the Check method, without quota_properties field, to perform + // these validations before calling the quota controller methods. These + // methods check only for project deletion to be wipe out compliant. + enum Code { + // This is never used. + UNSPECIFIED = 0; + + // Quota allocation failed. + // Same as [google.rpc.Code.RESOURCE_EXHAUSTED][google.rpc.Code.RESOURCE_EXHAUSTED]. + RESOURCE_EXHAUSTED = 8; + + // Consumer cannot access the service because the service requires active + // billing. + BILLING_NOT_ACTIVE = 107; + + // Consumer's project has been marked as deleted (soft deletion). + PROJECT_DELETED = 108; + + // Specified API key is invalid. + API_KEY_INVALID = 105; + + // Specified API Key has expired. + API_KEY_EXPIRED = 112; + } + + // Error code. + Code code = 1; + + // Subject to whom this error applies. See the specific enum for more details + // on this field. For example, "clientip:" or + // "project:". + string subject = 2; + + // Free-form text that provides details on the cause of the error. + string description = 3; + + // Contains additional information about the quota error. + // If available, `status.code` will be non zero. + google.rpc.Status status = 4; +} diff --git a/owl-bot-staging/v1/protos/google/api/servicecontrol/v1/service_controller.proto b/owl-bot-staging/v1/protos/google/api/servicecontrol/v1/service_controller.proto new file mode 100644 index 0000000..8580fc7 --- /dev/null +++ b/owl-bot-staging/v1/protos/google/api/servicecontrol/v1/service_controller.proto @@ -0,0 +1,256 @@ +// Copyright 2021 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +syntax = "proto3"; + +package google.api.servicecontrol.v1; + +import "google/api/annotations.proto"; +import "google/api/client.proto"; +import "google/api/servicecontrol/v1/check_error.proto"; +import "google/api/servicecontrol/v1/operation.proto"; +import "google/protobuf/timestamp.proto"; +import "google/rpc/status.proto"; + +option cc_enable_arenas = true; +option csharp_namespace = "Google.Cloud.ServiceControl.V1"; +option go_package = "google.golang.org/genproto/googleapis/api/servicecontrol/v1;servicecontrol"; +option java_multiple_files = true; +option java_outer_classname = "ServiceControllerProto"; +option java_package = "com.google.api.servicecontrol.v1"; +option objc_class_prefix = "GASC"; +option php_namespace = "Google\\Cloud\\ServiceControl\\V1"; +option ruby_package = "Google::Cloud::ServiceControl::V1"; + +// [Google Service Control API](/service-control/overview) +// +// Lets clients check and report operations against a [managed +// service](https://cloud.google.com/service-management/reference/rpc/google.api/servicemanagement.v1#google.api.servicemanagement.v1.ManagedService). +service ServiceController { + option (google.api.default_host) = "servicecontrol.googleapis.com"; + option (google.api.oauth_scopes) = + "https://www.googleapis.com/auth/cloud-platform," + "https://www.googleapis.com/auth/servicecontrol"; + + // Checks whether an operation on a service should be allowed to proceed + // based on the configuration of the service and related policies. It must be + // called before the operation is executed. + // + // If feasible, the client should cache the check results and reuse them for + // 60 seconds. In case of any server errors, the client should rely on the + // cached results for much longer time to avoid outage. + // WARNING: There is general 60s delay for the configuration and policy + // propagation, therefore callers MUST NOT depend on the `Check` method having + // the latest policy information. + // + // NOTE: the [CheckRequest][google.api.servicecontrol.v1.CheckRequest] has + // the size limit (wire-format byte size) of 1MB. + // + // This method requires the `servicemanagement.services.check` permission + // on the specified service. For more information, see + // [Cloud IAM](https://cloud.google.com/iam). + rpc Check(CheckRequest) returns (CheckResponse) { + option (google.api.http) = { + post: "/v1/services/{service_name}:check" + body: "*" + }; + } + + // Reports operation results to Google Service Control, such as logs and + // metrics. It should be called after an operation is completed. + // + // If feasible, the client should aggregate reporting data for up to 5 + // seconds to reduce API traffic. Limiting aggregation to 5 seconds is to + // reduce data loss during client crashes. Clients should carefully choose + // the aggregation time window to avoid data loss risk more than 0.01% + // for business and compliance reasons. + // + // NOTE: the [ReportRequest][google.api.servicecontrol.v1.ReportRequest] has + // the size limit (wire-format byte size) of 1MB. + // + // This method requires the `servicemanagement.services.report` permission + // on the specified service. For more information, see + // [Google Cloud IAM](https://cloud.google.com/iam). + rpc Report(ReportRequest) returns (ReportResponse) { + option (google.api.http) = { + post: "/v1/services/{service_name}:report" + body: "*" + }; + } +} + +// Request message for the Check method. +message CheckRequest { + // The service name as specified in its service configuration. For example, + // `"pubsub.googleapis.com"`. + // + // See + // [google.api.Service](https://cloud.google.com/service-management/reference/rpc/google.api#google.api.Service) + // for the definition of a service name. + string service_name = 1; + + // The operation to be checked. + Operation operation = 2; + + // Specifies which version of service configuration should be used to process + // the request. + // + // If unspecified or no matching version can be found, the + // latest one will be used. + string service_config_id = 4; +} + +// Response message for the Check method. +message CheckResponse { + // Contains additional information about the check operation. + message CheckInfo { + // A list of fields and label keys that are ignored by the server. + // The client doesn't need to send them for following requests to improve + // performance and allow better aggregation. + repeated string unused_arguments = 1; + + // Consumer info of this check. + ConsumerInfo consumer_info = 2; + } + + // `ConsumerInfo` provides information about the consumer. + message ConsumerInfo { + // The type of the consumer as defined in + // [Google Resource Manager](https://cloud.google.com/resource-manager/). + enum ConsumerType { + // This is never used. + CONSUMER_TYPE_UNSPECIFIED = 0; + + // The consumer is a Google Cloud Project. + PROJECT = 1; + + // The consumer is a Google Cloud Folder. + FOLDER = 2; + + // The consumer is a Google Cloud Organization. + ORGANIZATION = 3; + + // Service-specific resource container which is defined by the service + // producer to offer their users the ability to manage service control + // functionalities at a finer level of granularity than the PROJECT. + SERVICE_SPECIFIC = 4; + } + + // The Google cloud project number, e.g. 1234567890. A value of 0 indicates + // no project number is found. + // + // NOTE: This field is deprecated after we support flexible consumer + // id. New code should not depend on this field anymore. + int64 project_number = 1; + + // The type of the consumer which should have been defined in + // [Google Resource Manager](https://cloud.google.com/resource-manager/). + ConsumerType type = 2; + + // The consumer identity number, can be Google cloud project number, folder + // number or organization number e.g. 1234567890. A value of 0 indicates no + // consumer number is found. + int64 consumer_number = 3; + } + + // The same operation_id value used in the + // [CheckRequest][google.api.servicecontrol.v1.CheckRequest]. Used for logging + // and diagnostics purposes. + string operation_id = 1; + + // Indicate the decision of the check. + // + // If no check errors are present, the service should process the operation. + // Otherwise the service should use the list of errors to determine the + // appropriate action. + repeated CheckError check_errors = 2; + + // The actual config id used to process the request. + string service_config_id = 5; + + // The current service rollout id used to process the request. + string service_rollout_id = 11; + + // Feedback data returned from the server during processing a Check request. + CheckInfo check_info = 6; +} + +// Request message for the Report method. +message ReportRequest { + // The service name as specified in its service configuration. For example, + // `"pubsub.googleapis.com"`. + // + // See + // [google.api.Service](https://cloud.google.com/service-management/reference/rpc/google.api#google.api.Service) + // for the definition of a service name. + string service_name = 1; + + // Operations to be reported. + // + // Typically the service should report one operation per request. + // Putting multiple operations into a single request is allowed, but should + // be used only when multiple operations are natually available at the time + // of the report. + // + // There is no limit on the number of operations in the same ReportRequest, + // however the ReportRequest size should be no larger than 1MB. See + // [ReportResponse.report_errors][google.api.servicecontrol.v1.ReportResponse.report_errors] + // for partial failure behavior. + repeated Operation operations = 2; + + // Specifies which version of service config should be used to process the + // request. + // + // If unspecified or no matching version can be found, the + // latest one will be used. + string service_config_id = 3; +} + +// Response message for the Report method. +message ReportResponse { + // Represents the processing error of one + // [Operation][google.api.servicecontrol.v1.Operation] in the request. + message ReportError { + // The + // [Operation.operation_id][google.api.servicecontrol.v1.Operation.operation_id] + // value from the request. + string operation_id = 1; + + // Details of the error when processing the + // [Operation][google.api.servicecontrol.v1.Operation]. + google.rpc.Status status = 2; + } + + // Partial failures, one for each `Operation` in the request that failed + // processing. There are three possible combinations of the RPC status: + // + // 1. The combination of a successful RPC status and an empty `report_errors` + // list indicates a complete success where all `Operations` in the + // request are processed successfully. + // 2. The combination of a successful RPC status and a non-empty + // `report_errors` list indicates a partial success where some + // `Operations` in the request succeeded. Each + // `Operation` that failed processing has a corresponding item + // in this list. + // 3. A failed RPC status indicates a general non-deterministic failure. + // When this happens, it's impossible to know which of the + // 'Operations' in the request succeeded or failed. + repeated ReportError report_errors = 1; + + // The actual config id used to process the request. + string service_config_id = 2; + + // The current service rollout id used to process the request. + string service_rollout_id = 4; +} diff --git a/owl-bot-staging/v1/protos/google/logging/type/http_request.proto b/owl-bot-staging/v1/protos/google/logging/type/http_request.proto new file mode 100644 index 0000000..b878d60 --- /dev/null +++ b/owl-bot-staging/v1/protos/google/logging/type/http_request.proto @@ -0,0 +1,95 @@ +// Copyright 2022 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.logging.type; + +import "google/protobuf/duration.proto"; + +option csharp_namespace = "Google.Cloud.Logging.Type"; +option go_package = "google.golang.org/genproto/googleapis/logging/type;ltype"; +option java_multiple_files = true; +option java_outer_classname = "HttpRequestProto"; +option java_package = "com.google.logging.type"; +option php_namespace = "Google\\Cloud\\Logging\\Type"; +option ruby_package = "Google::Cloud::Logging::Type"; + +// A common proto for logging HTTP requests. Only contains semantics +// defined by the HTTP specification. Product-specific logging +// information MUST be defined in a separate message. +message HttpRequest { + // The request method. Examples: `"GET"`, `"HEAD"`, `"PUT"`, `"POST"`. + string request_method = 1; + + // The scheme (http, https), the host name, the path and the query + // portion of the URL that was requested. + // Example: `"http://example.com/some/info?color=red"`. + string request_url = 2; + + // The size of the HTTP request message in bytes, including the request + // headers and the request body. + int64 request_size = 3; + + // The response code indicating the status of response. + // Examples: 200, 404. + int32 status = 4; + + // The size of the HTTP response message sent back to the client, in bytes, + // including the response headers and the response body. + int64 response_size = 5; + + // The user agent sent by the client. Example: + // `"Mozilla/4.0 (compatible; MSIE 6.0; Windows 98; Q312461; .NET + // CLR 1.0.3705)"`. + string user_agent = 6; + + // The IP address (IPv4 or IPv6) of the client that issued the HTTP + // request. This field can include port information. Examples: + // `"192.168.1.1"`, `"10.0.0.1:80"`, `"FE80::0202:B3FF:FE1E:8329"`. + string remote_ip = 7; + + // The IP address (IPv4 or IPv6) of the origin server that the request was + // sent to. This field can include port information. Examples: + // `"192.168.1.1"`, `"10.0.0.1:80"`, `"FE80::0202:B3FF:FE1E:8329"`. + string server_ip = 13; + + // The referer URL of the request, as defined in + // [HTTP/1.1 Header Field + // Definitions](http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html). + string referer = 8; + + // The request processing latency on the server, from the time the request was + // received until the response was sent. + google.protobuf.Duration latency = 14; + + // Whether or not a cache lookup was attempted. + bool cache_lookup = 11; + + // Whether or not an entity was served from cache + // (with or without validation). + bool cache_hit = 9; + + // Whether or not the response was validated with the origin server before + // being served from cache. This field is only meaningful if `cache_hit` is + // True. + bool cache_validated_with_origin_server = 10; + + // The number of HTTP response bytes inserted into cache. Set only when a + // cache fill was attempted. + int64 cache_fill_bytes = 12; + + // Protocol used for the request. Examples: "HTTP/1.1", "HTTP/2", "websocket" + string protocol = 15; +} diff --git a/owl-bot-staging/v1/protos/google/logging/type/log_severity.proto b/owl-bot-staging/v1/protos/google/logging/type/log_severity.proto new file mode 100644 index 0000000..bed7193 --- /dev/null +++ b/owl-bot-staging/v1/protos/google/logging/type/log_severity.proto @@ -0,0 +1,71 @@ +// Copyright 2022 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.logging.type; + +option csharp_namespace = "Google.Cloud.Logging.Type"; +option go_package = "google.golang.org/genproto/googleapis/logging/type;ltype"; +option java_multiple_files = true; +option java_outer_classname = "LogSeverityProto"; +option java_package = "com.google.logging.type"; +option objc_class_prefix = "GLOG"; +option php_namespace = "Google\\Cloud\\Logging\\Type"; +option ruby_package = "Google::Cloud::Logging::Type"; + +// The severity of the event described in a log entry, expressed as one of the +// standard severity levels listed below. For your reference, the levels are +// assigned the listed numeric values. The effect of using numeric values other +// than those listed is undefined. +// +// You can filter for log entries by severity. For example, the following +// filter expression will match log entries with severities `INFO`, `NOTICE`, +// and `WARNING`: +// +// severity > DEBUG AND severity <= WARNING +// +// If you are writing log entries, you should map other severity encodings to +// one of these standard levels. For example, you might map all of Java's FINE, +// FINER, and FINEST levels to `LogSeverity.DEBUG`. You can preserve the +// original severity level in the log entry payload if you wish. +enum LogSeverity { + // (0) The log entry has no assigned severity level. + DEFAULT = 0; + + // (100) Debug or trace information. + DEBUG = 100; + + // (200) Routine information, such as ongoing status or performance. + INFO = 200; + + // (300) Normal but significant events, such as start up, shut down, or + // a configuration change. + NOTICE = 300; + + // (400) Warning events might cause problems. + WARNING = 400; + + // (500) Error events are likely to cause problems. + ERROR = 500; + + // (600) Critical events cause more severe problems or outages. + CRITICAL = 600; + + // (700) A person must take an action immediately. + ALERT = 700; + + // (800) One or more systems are unusable. + EMERGENCY = 800; +} diff --git a/owl-bot-staging/v1/samples/generated/v1/quota_controller.allocate_quota.js b/owl-bot-staging/v1/samples/generated/v1/quota_controller.allocate_quota.js new file mode 100644 index 0000000..554e011 --- /dev/null +++ b/owl-bot-staging/v1/samples/generated/v1/quota_controller.allocate_quota.js @@ -0,0 +1,69 @@ +// Copyright 2022 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 servicecontrol_v1_generated_QuotaController_AllocateQuota_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Name of the service as specified in the service configuration. For example, + * `"pubsub.googleapis.com"`. + * See google.api.Service google.api.Service for the definition of a service name. + */ + // const serviceName = 'abc123' + /** + * Operation that describes the quota allocation. + */ + // const allocateOperation = {} + /** + * Specifies which version of service configuration should be used to process + * the request. If unspecified or no matching version can be found, the latest + * one will be used. + */ + // const serviceConfigId = 'abc123' + + // Imports the Servicecontrol library + const {QuotaControllerClient} = require('@google-cloud/service-control').v1; + + // Instantiates a client + const servicecontrolClient = new QuotaControllerClient(); + + async function callAllocateQuota() { + // Construct request + const request = { + }; + + // Run request + const response = await servicecontrolClient.allocateQuota(request); + console.log(response); + } + + callAllocateQuota(); + // [END servicecontrol_v1_generated_QuotaController_AllocateQuota_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/v1/samples/generated/v1/service_controller.check.js b/owl-bot-staging/v1/samples/generated/v1/service_controller.check.js new file mode 100644 index 0000000..84c1b36 --- /dev/null +++ b/owl-bot-staging/v1/samples/generated/v1/service_controller.check.js @@ -0,0 +1,72 @@ +// Copyright 2022 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 servicecontrol_v1_generated_ServiceController_Check_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * The service name as specified in its service configuration. For example, + * `"pubsub.googleapis.com"`. + * See + * google.api.Service (https://cloud.google.com/service-management/reference/rpc/google.api#google.api.Service) + * for the definition of a service name. + */ + // const serviceName = 'abc123' + /** + * The operation to be checked. + */ + // const operation = {} + /** + * Specifies which version of service configuration should be used to process + * the request. + * If unspecified or no matching version can be found, the + * latest one will be used. + */ + // const serviceConfigId = 'abc123' + + // Imports the Servicecontrol library + const {ServiceControllerClient} = require('@google-cloud/service-control').v1; + + // Instantiates a client + const servicecontrolClient = new ServiceControllerClient(); + + async function callCheck() { + // Construct request + const request = { + }; + + // Run request + const response = await servicecontrolClient.check(request); + console.log(response); + } + + callCheck(); + // [END servicecontrol_v1_generated_ServiceController_Check_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/v1/samples/generated/v1/service_controller.report.js b/owl-bot-staging/v1/samples/generated/v1/service_controller.report.js new file mode 100644 index 0000000..40ce695 --- /dev/null +++ b/owl-bot-staging/v1/samples/generated/v1/service_controller.report.js @@ -0,0 +1,80 @@ +// Copyright 2022 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 servicecontrol_v1_generated_ServiceController_Report_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * The service name as specified in its service configuration. For example, + * `"pubsub.googleapis.com"`. + * See + * google.api.Service (https://cloud.google.com/service-management/reference/rpc/google.api#google.api.Service) + * for the definition of a service name. + */ + // const serviceName = 'abc123' + /** + * Operations to be reported. + * Typically the service should report one operation per request. + * Putting multiple operations into a single request is allowed, but should + * be used only when multiple operations are natually available at the time + * of the report. + * There is no limit on the number of operations in the same ReportRequest, + * however the ReportRequest size should be no larger than 1MB. See + * ReportResponse.report_errors google.api.servicecontrol.v1.ReportResponse.report_errors + * for partial failure behavior. + */ + // const operations = 1234 + /** + * Specifies which version of service config should be used to process the + * request. + * If unspecified or no matching version can be found, the + * latest one will be used. + */ + // const serviceConfigId = 'abc123' + + // Imports the Servicecontrol library + const {ServiceControllerClient} = require('@google-cloud/service-control').v1; + + // Instantiates a client + const servicecontrolClient = new ServiceControllerClient(); + + async function callReport() { + // Construct request + const request = { + }; + + // Run request + const response = await servicecontrolClient.report(request); + console.log(response); + } + + callReport(); + // [END servicecontrol_v1_generated_ServiceController_Report_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/v1/samples/generated/v1/snippet_metadata.google.api.servicecontrol.v1.json b/owl-bot-staging/v1/samples/generated/v1/snippet_metadata.google.api.servicecontrol.v1.json new file mode 100644 index 0000000..8b1d261 --- /dev/null +++ b/owl-bot-staging/v1/samples/generated/v1/snippet_metadata.google.api.servicecontrol.v1.json @@ -0,0 +1,159 @@ +{ + "clientLibrary": { + "name": "nodejs-servicecontrol", + "version": "0.1.0", + "language": "TYPESCRIPT", + "apis": [ + { + "id": "google.api.servicecontrol.v1", + "version": "v1" + } + ] + }, + "snippets": [ + { + "regionTag": "servicecontrol_v1_generated_QuotaController_AllocateQuota_async", + "title": "QuotaController allocateQuota Sample", + "origin": "API_DEFINITION", + "description": " Attempts to allocate quota for the specified consumer. It should be called before the operation is executed. This method requires the `servicemanagement.services.quota` permission on the specified service. For more information, see [Cloud IAM](https://cloud.google.com/iam). **NOTE:** The client **must** fail-open on server errors `INTERNAL`, `UNKNOWN`, `DEADLINE_EXCEEDED`, and `UNAVAILABLE`. To ensure system reliability, the server may inject these errors to prohibit any hard dependency on the quota functionality.", + "canonical": true, + "file": "quota_controller.allocate_quota.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 61, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "AllocateQuota", + "fullName": "google.api.servicecontrol.v1.QuotaController.AllocateQuota", + "async": true, + "parameters": [ + { + "name": "service_name", + "type": "TYPE_STRING" + }, + { + "name": "allocate_operation", + "type": ".google.api.servicecontrol.v1.QuotaOperation" + }, + { + "name": "service_config_id", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.api.servicecontrol.v1.AllocateQuotaResponse", + "client": { + "shortName": "QuotaControllerClient", + "fullName": "google.api.servicecontrol.v1.QuotaControllerClient" + }, + "method": { + "shortName": "AllocateQuota", + "fullName": "google.api.servicecontrol.v1.QuotaController.AllocateQuota", + "service": { + "shortName": "QuotaController", + "fullName": "google.api.servicecontrol.v1.QuotaController" + } + } + } + }, + { + "regionTag": "servicecontrol_v1_generated_ServiceController_Check_async", + "title": "QuotaController check Sample", + "origin": "API_DEFINITION", + "description": " Checks whether an operation on a service should be allowed to proceed based on the configuration of the service and related policies. It must be called before the operation is executed. If feasible, the client should cache the check results and reuse them for 60 seconds. In case of any server errors, the client should rely on the cached results for much longer time to avoid outage. WARNING: There is general 60s delay for the configuration and policy propagation, therefore callers MUST NOT depend on the `Check` method having the latest policy information. NOTE: the [CheckRequest][google.api.servicecontrol.v1.CheckRequest] has the size limit (wire-format byte size) of 1MB. This method requires the `servicemanagement.services.check` permission on the specified service. For more information, see [Cloud IAM](https://cloud.google.com/iam).", + "canonical": true, + "file": "service_controller.check.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 64, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "Check", + "fullName": "google.api.servicecontrol.v1.ServiceController.Check", + "async": true, + "parameters": [ + { + "name": "service_name", + "type": "TYPE_STRING" + }, + { + "name": "operation", + "type": ".google.api.servicecontrol.v1.Operation" + }, + { + "name": "service_config_id", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.api.servicecontrol.v1.CheckResponse", + "client": { + "shortName": "ServiceControllerClient", + "fullName": "google.api.servicecontrol.v1.ServiceControllerClient" + }, + "method": { + "shortName": "Check", + "fullName": "google.api.servicecontrol.v1.ServiceController.Check", + "service": { + "shortName": "ServiceController", + "fullName": "google.api.servicecontrol.v1.ServiceController" + } + } + } + }, + { + "regionTag": "servicecontrol_v1_generated_ServiceController_Report_async", + "title": "QuotaController report Sample", + "origin": "API_DEFINITION", + "description": " Reports operation results to Google Service Control, such as logs and metrics. It should be called after an operation is completed. If feasible, the client should aggregate reporting data for up to 5 seconds to reduce API traffic. Limiting aggregation to 5 seconds is to reduce data loss during client crashes. Clients should carefully choose the aggregation time window to avoid data loss risk more than 0.01% for business and compliance reasons. NOTE: the [ReportRequest][google.api.servicecontrol.v1.ReportRequest] has the size limit (wire-format byte size) of 1MB. This method requires the `servicemanagement.services.report` permission on the specified service. For more information, see [Google Cloud IAM](https://cloud.google.com/iam).", + "canonical": true, + "file": "service_controller.report.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 72, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "Report", + "fullName": "google.api.servicecontrol.v1.ServiceController.Report", + "async": true, + "parameters": [ + { + "name": "service_name", + "type": "TYPE_STRING" + }, + { + "name": "operations", + "type": "TYPE_MESSAGE[]" + }, + { + "name": "service_config_id", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.api.servicecontrol.v1.ReportResponse", + "client": { + "shortName": "ServiceControllerClient", + "fullName": "google.api.servicecontrol.v1.ServiceControllerClient" + }, + "method": { + "shortName": "Report", + "fullName": "google.api.servicecontrol.v1.ServiceController.Report", + "service": { + "shortName": "ServiceController", + "fullName": "google.api.servicecontrol.v1.ServiceController" + } + } + } + } + ] +} diff --git a/owl-bot-staging/v1/src/index.ts b/owl-bot-staging/v1/src/index.ts new file mode 100644 index 0000000..146ff76 --- /dev/null +++ b/owl-bot-staging/v1/src/index.ts @@ -0,0 +1,27 @@ +// Copyright 2022 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 QuotaControllerClient = v1.QuotaControllerClient; +type QuotaControllerClient = v1.QuotaControllerClient; +const ServiceControllerClient = v1.ServiceControllerClient; +type ServiceControllerClient = v1.ServiceControllerClient; +export {v1, QuotaControllerClient, ServiceControllerClient}; +export default {v1, QuotaControllerClient, ServiceControllerClient}; +import * as protos from '../protos/protos'; +export {protos} diff --git a/owl-bot-staging/v1/src/v1/gapic_metadata.json b/owl-bot-staging/v1/src/v1/gapic_metadata.json new file mode 100644 index 0000000..9fc6596 --- /dev/null +++ b/owl-bot-staging/v1/src/v1/gapic_metadata.json @@ -0,0 +1,67 @@ +{ + "schema": "1.0", + "comment": "This file maps proto services/RPCs to the corresponding library clients/methods", + "language": "typescript", + "protoPackage": "google.api.servicecontrol.v1", + "libraryPackage": "@google-cloud/service-control", + "services": { + "QuotaController": { + "clients": { + "grpc": { + "libraryClient": "QuotaControllerClient", + "rpcs": { + "AllocateQuota": { + "methods": [ + "allocateQuota" + ] + } + } + }, + "grpc-fallback": { + "libraryClient": "QuotaControllerClient", + "rpcs": { + "AllocateQuota": { + "methods": [ + "allocateQuota" + ] + } + } + } + } + }, + "ServiceController": { + "clients": { + "grpc": { + "libraryClient": "ServiceControllerClient", + "rpcs": { + "Check": { + "methods": [ + "check" + ] + }, + "Report": { + "methods": [ + "report" + ] + } + } + }, + "grpc-fallback": { + "libraryClient": "ServiceControllerClient", + "rpcs": { + "Check": { + "methods": [ + "check" + ] + }, + "Report": { + "methods": [ + "report" + ] + } + } + } + } + } + } +} diff --git a/owl-bot-staging/v1/src/v1/index.ts b/owl-bot-staging/v1/src/v1/index.ts new file mode 100644 index 0000000..cc86d9f --- /dev/null +++ b/owl-bot-staging/v1/src/v1/index.ts @@ -0,0 +1,20 @@ +// Copyright 2022 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 {QuotaControllerClient} from './quota_controller_client'; +export {ServiceControllerClient} from './service_controller_client'; diff --git a/owl-bot-staging/v1/src/v1/quota_controller_client.ts b/owl-bot-staging/v1/src/v1/quota_controller_client.ts new file mode 100644 index 0000000..5982e8b --- /dev/null +++ b/owl-bot-staging/v1/src/v1/quota_controller_client.ts @@ -0,0 +1,386 @@ +// Copyright 2022 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 * as gax from 'google-gax'; +import {Callback, CallOptions, Descriptors, ClientOptions} from 'google-gax'; + +import * as protos from '../../protos/protos'; +import jsonProtos = require('../../protos/protos.json'); +/** + * Client JSON configuration object, loaded from + * `src/v1/quota_controller_client_config.json`. + * This file defines retry strategy and timeouts for all API methods in this library. + */ +import * as gapicConfig from './quota_controller_client_config.json'; + +const version = require('../../../package.json').version; + +/** + * [Google Quota Control API](/service-control/overview) + * + * Allows clients to allocate and release quota against a [managed + * service](https://cloud.google.com/service-management/reference/rpc/google.api/servicemanagement.v1#google.api.servicemanagement.v1.ManagedService). + * @class + * @memberof v1 + */ +export class QuotaControllerClient { + 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}; + quotaControllerStub?: Promise<{[name: string]: Function}>; + + /** + * Construct an instance of QuotaControllerClient. + * + * @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}. + */ + constructor(opts?: ClientOptions) { + // Ensure that options include all the required fields. + const staticMembers = this.constructor as typeof QuotaControllerClient; + 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); + + // 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; + } + + // Choose either gRPC or proto-over-HTTP implementation of google-gax. + this._gaxModule = opts.fallback ? gax.fallback : gax; + + // 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); + + // Put together the default options sent with requests. + this._defaults = this._gaxGrpc.constructSettings( + 'google.api.servicecontrol.v1.QuotaController', 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 = gax.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.quotaControllerStub) { + return this.quotaControllerStub; + } + + // Put together the "service stub" for + // google.api.servicecontrol.v1.QuotaController. + this.quotaControllerStub = this._gaxGrpc.createStub( + this._opts.fallback ? + (this._protos as protobuf.Root).lookupService('google.api.servicecontrol.v1.QuotaController') : + // eslint-disable-next-line @typescript-eslint/no-explicit-any + (this._protos as any).google.api.servicecontrol.v1.QuotaController, + 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 quotaControllerStubMethods = + ['allocateQuota']; + for (const methodName of quotaControllerStubMethods) { + const callPromise = this.quotaControllerStub.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 = + undefined; + const apiCall = this._gaxModule.createApiCall( + callPromise, + this._defaults[methodName], + descriptor + ); + + this.innerApiCalls[methodName] = apiCall; + } + + return this.quotaControllerStub; + } + + /** + * The DNS address for this API service. + * @returns {string} The DNS address for this service. + */ + static get servicePath() { + return 'servicecontrol.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 'servicecontrol.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/cloud-platform', + 'https://www.googleapis.com/auth/servicecontrol' + ]; + } + + 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 -- + // ------------------- +/** + * Attempts to allocate quota for the specified consumer. It should be called + * before the operation is executed. + * + * This method requires the `servicemanagement.services.quota` + * permission on the specified service. For more information, see + * [Cloud IAM](https://cloud.google.com/iam). + * + * **NOTE:** The client **must** fail-open on server errors `INTERNAL`, + * `UNKNOWN`, `DEADLINE_EXCEEDED`, and `UNAVAILABLE`. To ensure system + * reliability, the server may inject these errors to prohibit any hard + * dependency on the quota functionality. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.serviceName + * Name of the service as specified in the service configuration. For example, + * `"pubsub.googleapis.com"`. + * + * See {@link google.api.Service|google.api.Service} for the definition of a service name. + * @param {google.api.servicecontrol.v1.QuotaOperation} request.allocateOperation + * Operation that describes the quota allocation. + * @param {string} request.serviceConfigId + * Specifies which version of service configuration should be used to process + * the request. If unspecified or no matching version can be found, the latest + * one will be used. + * @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 [AllocateQuotaResponse]{@link google.api.servicecontrol.v1.AllocateQuotaResponse}. + * 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/quota_controller.allocate_quota.js + * region_tag:servicecontrol_v1_generated_QuotaController_AllocateQuota_async + */ + allocateQuota( + request?: protos.google.api.servicecontrol.v1.IAllocateQuotaRequest, + options?: CallOptions): + Promise<[ + protos.google.api.servicecontrol.v1.IAllocateQuotaResponse, + protos.google.api.servicecontrol.v1.IAllocateQuotaRequest|undefined, {}|undefined + ]>; + allocateQuota( + request: protos.google.api.servicecontrol.v1.IAllocateQuotaRequest, + options: CallOptions, + callback: Callback< + protos.google.api.servicecontrol.v1.IAllocateQuotaResponse, + protos.google.api.servicecontrol.v1.IAllocateQuotaRequest|null|undefined, + {}|null|undefined>): void; + allocateQuota( + request: protos.google.api.servicecontrol.v1.IAllocateQuotaRequest, + callback: Callback< + protos.google.api.servicecontrol.v1.IAllocateQuotaResponse, + protos.google.api.servicecontrol.v1.IAllocateQuotaRequest|null|undefined, + {}|null|undefined>): void; + allocateQuota( + request?: protos.google.api.servicecontrol.v1.IAllocateQuotaRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.api.servicecontrol.v1.IAllocateQuotaResponse, + protos.google.api.servicecontrol.v1.IAllocateQuotaRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.api.servicecontrol.v1.IAllocateQuotaResponse, + protos.google.api.servicecontrol.v1.IAllocateQuotaRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.api.servicecontrol.v1.IAllocateQuotaResponse, + protos.google.api.servicecontrol.v1.IAllocateQuotaRequest|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' + ] = gax.routingHeader.fromParams({ + 'service_name': request.serviceName || '', + }); + this.initialize(); + return this.innerApiCalls.allocateQuota(request, options, callback); + } + + + /** + * 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.quotaControllerStub && !this._terminated) { + return this.quotaControllerStub.then(stub => { + this._terminated = true; + stub.close(); + }); + } + return Promise.resolve(); + } +} diff --git a/owl-bot-staging/v1/src/v1/quota_controller_client_config.json b/owl-bot-staging/v1/src/v1/quota_controller_client_config.json new file mode 100644 index 0000000..61ecf93 --- /dev/null +++ b/owl-bot-staging/v1/src/v1/quota_controller_client_config.json @@ -0,0 +1,30 @@ +{ + "interfaces": { + "google.api.servicecontrol.v1.QuotaController": { + "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": { + "AllocateQuota": { + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + } + } + } + } +} diff --git a/owl-bot-staging/v1/src/v1/quota_controller_proto_list.json b/owl-bot-staging/v1/src/v1/quota_controller_proto_list.json new file mode 100644 index 0000000..a93106a --- /dev/null +++ b/owl-bot-staging/v1/src/v1/quota_controller_proto_list.json @@ -0,0 +1,11 @@ +[ + "../../protos/google/api/servicecontrol/v1/check_error.proto", + "../../protos/google/api/servicecontrol/v1/distribution.proto", + "../../protos/google/api/servicecontrol/v1/http_request.proto", + "../../protos/google/api/servicecontrol/v1/log_entry.proto", + "../../protos/google/api/servicecontrol/v1/metric_value.proto", + "../../protos/google/api/servicecontrol/v1/operation.proto", + "../../protos/google/api/servicecontrol/v1/quota_controller.proto", + "../../protos/google/api/servicecontrol/v1/service_controller.proto", + "../../protos/google/logging/type/log_severity.proto" +] diff --git a/owl-bot-staging/v1/src/v1/service_controller_client.ts b/owl-bot-staging/v1/src/v1/service_controller_client.ts new file mode 100644 index 0000000..f497562 --- /dev/null +++ b/owl-bot-staging/v1/src/v1/service_controller_client.ts @@ -0,0 +1,504 @@ +// Copyright 2022 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 * as gax from 'google-gax'; +import {Callback, CallOptions, Descriptors, ClientOptions} from 'google-gax'; + +import * as protos from '../../protos/protos'; +import jsonProtos = require('../../protos/protos.json'); +/** + * Client JSON configuration object, loaded from + * `src/v1/service_controller_client_config.json`. + * This file defines retry strategy and timeouts for all API methods in this library. + */ +import * as gapicConfig from './service_controller_client_config.json'; + +const version = require('../../../package.json').version; + +/** + * [Google Service Control API](/service-control/overview) + * + * Lets clients check and report operations against a [managed + * service](https://cloud.google.com/service-management/reference/rpc/google.api/servicemanagement.v1#google.api.servicemanagement.v1.ManagedService). + * @class + * @memberof v1 + */ +export class ServiceControllerClient { + 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}; + serviceControllerStub?: Promise<{[name: string]: Function}>; + + /** + * Construct an instance of ServiceControllerClient. + * + * @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}. + */ + constructor(opts?: ClientOptions) { + // Ensure that options include all the required fields. + const staticMembers = this.constructor as typeof ServiceControllerClient; + 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); + + // 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; + } + + // Choose either gRPC or proto-over-HTTP implementation of google-gax. + this._gaxModule = opts.fallback ? gax.fallback : gax; + + // 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); + + // Put together the default options sent with requests. + this._defaults = this._gaxGrpc.constructSettings( + 'google.api.servicecontrol.v1.ServiceController', 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 = gax.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.serviceControllerStub) { + return this.serviceControllerStub; + } + + // Put together the "service stub" for + // google.api.servicecontrol.v1.ServiceController. + this.serviceControllerStub = this._gaxGrpc.createStub( + this._opts.fallback ? + (this._protos as protobuf.Root).lookupService('google.api.servicecontrol.v1.ServiceController') : + // eslint-disable-next-line @typescript-eslint/no-explicit-any + (this._protos as any).google.api.servicecontrol.v1.ServiceController, + 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 serviceControllerStubMethods = + ['check', 'report']; + for (const methodName of serviceControllerStubMethods) { + const callPromise = this.serviceControllerStub.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 = + undefined; + const apiCall = this._gaxModule.createApiCall( + callPromise, + this._defaults[methodName], + descriptor + ); + + this.innerApiCalls[methodName] = apiCall; + } + + return this.serviceControllerStub; + } + + /** + * The DNS address for this API service. + * @returns {string} The DNS address for this service. + */ + static get servicePath() { + return 'servicecontrol.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 'servicecontrol.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/cloud-platform', + 'https://www.googleapis.com/auth/servicecontrol' + ]; + } + + 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 -- + // ------------------- +/** + * Checks whether an operation on a service should be allowed to proceed + * based on the configuration of the service and related policies. It must be + * called before the operation is executed. + * + * If feasible, the client should cache the check results and reuse them for + * 60 seconds. In case of any server errors, the client should rely on the + * cached results for much longer time to avoid outage. + * WARNING: There is general 60s delay for the configuration and policy + * propagation, therefore callers MUST NOT depend on the `Check` method having + * the latest policy information. + * + * NOTE: the {@link google.api.servicecontrol.v1.CheckRequest|CheckRequest} has + * the size limit (wire-format byte size) of 1MB. + * + * This method requires the `servicemanagement.services.check` permission + * on the specified service. For more information, see + * [Cloud IAM](https://cloud.google.com/iam). + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.serviceName + * The service name as specified in its service configuration. For example, + * `"pubsub.googleapis.com"`. + * + * See + * [google.api.Service](https://cloud.google.com/service-management/reference/rpc/google.api#google.api.Service) + * for the definition of a service name. + * @param {google.api.servicecontrol.v1.Operation} request.operation + * The operation to be checked. + * @param {string} request.serviceConfigId + * Specifies which version of service configuration should be used to process + * the request. + * + * If unspecified or no matching version can be found, the + * latest one will be used. + * @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 [CheckResponse]{@link google.api.servicecontrol.v1.CheckResponse}. + * 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/service_controller.check.js + * region_tag:servicecontrol_v1_generated_ServiceController_Check_async + */ + check( + request?: protos.google.api.servicecontrol.v1.ICheckRequest, + options?: CallOptions): + Promise<[ + protos.google.api.servicecontrol.v1.ICheckResponse, + protos.google.api.servicecontrol.v1.ICheckRequest|undefined, {}|undefined + ]>; + check( + request: protos.google.api.servicecontrol.v1.ICheckRequest, + options: CallOptions, + callback: Callback< + protos.google.api.servicecontrol.v1.ICheckResponse, + protos.google.api.servicecontrol.v1.ICheckRequest|null|undefined, + {}|null|undefined>): void; + check( + request: protos.google.api.servicecontrol.v1.ICheckRequest, + callback: Callback< + protos.google.api.servicecontrol.v1.ICheckResponse, + protos.google.api.servicecontrol.v1.ICheckRequest|null|undefined, + {}|null|undefined>): void; + check( + request?: protos.google.api.servicecontrol.v1.ICheckRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.api.servicecontrol.v1.ICheckResponse, + protos.google.api.servicecontrol.v1.ICheckRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.api.servicecontrol.v1.ICheckResponse, + protos.google.api.servicecontrol.v1.ICheckRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.api.servicecontrol.v1.ICheckResponse, + protos.google.api.servicecontrol.v1.ICheckRequest|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' + ] = gax.routingHeader.fromParams({ + 'service_name': request.serviceName || '', + }); + this.initialize(); + return this.innerApiCalls.check(request, options, callback); + } +/** + * Reports operation results to Google Service Control, such as logs and + * metrics. It should be called after an operation is completed. + * + * If feasible, the client should aggregate reporting data for up to 5 + * seconds to reduce API traffic. Limiting aggregation to 5 seconds is to + * reduce data loss during client crashes. Clients should carefully choose + * the aggregation time window to avoid data loss risk more than 0.01% + * for business and compliance reasons. + * + * NOTE: the {@link google.api.servicecontrol.v1.ReportRequest|ReportRequest} has + * the size limit (wire-format byte size) of 1MB. + * + * This method requires the `servicemanagement.services.report` permission + * on the specified service. For more information, see + * [Google Cloud IAM](https://cloud.google.com/iam). + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.serviceName + * The service name as specified in its service configuration. For example, + * `"pubsub.googleapis.com"`. + * + * See + * [google.api.Service](https://cloud.google.com/service-management/reference/rpc/google.api#google.api.Service) + * for the definition of a service name. + * @param {number[]} request.operations + * Operations to be reported. + * + * Typically the service should report one operation per request. + * Putting multiple operations into a single request is allowed, but should + * be used only when multiple operations are natually available at the time + * of the report. + * + * There is no limit on the number of operations in the same ReportRequest, + * however the ReportRequest size should be no larger than 1MB. See + * {@link google.api.servicecontrol.v1.ReportResponse.report_errors|ReportResponse.report_errors} + * for partial failure behavior. + * @param {string} request.serviceConfigId + * Specifies which version of service config should be used to process the + * request. + * + * If unspecified or no matching version can be found, the + * latest one will be used. + * @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 [ReportResponse]{@link google.api.servicecontrol.v1.ReportResponse}. + * 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/service_controller.report.js + * region_tag:servicecontrol_v1_generated_ServiceController_Report_async + */ + report( + request?: protos.google.api.servicecontrol.v1.IReportRequest, + options?: CallOptions): + Promise<[ + protos.google.api.servicecontrol.v1.IReportResponse, + protos.google.api.servicecontrol.v1.IReportRequest|undefined, {}|undefined + ]>; + report( + request: protos.google.api.servicecontrol.v1.IReportRequest, + options: CallOptions, + callback: Callback< + protos.google.api.servicecontrol.v1.IReportResponse, + protos.google.api.servicecontrol.v1.IReportRequest|null|undefined, + {}|null|undefined>): void; + report( + request: protos.google.api.servicecontrol.v1.IReportRequest, + callback: Callback< + protos.google.api.servicecontrol.v1.IReportResponse, + protos.google.api.servicecontrol.v1.IReportRequest|null|undefined, + {}|null|undefined>): void; + report( + request?: protos.google.api.servicecontrol.v1.IReportRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.api.servicecontrol.v1.IReportResponse, + protos.google.api.servicecontrol.v1.IReportRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.api.servicecontrol.v1.IReportResponse, + protos.google.api.servicecontrol.v1.IReportRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.api.servicecontrol.v1.IReportResponse, + protos.google.api.servicecontrol.v1.IReportRequest|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' + ] = gax.routingHeader.fromParams({ + 'service_name': request.serviceName || '', + }); + this.initialize(); + return this.innerApiCalls.report(request, options, callback); + } + + + /** + * 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.serviceControllerStub && !this._terminated) { + return this.serviceControllerStub.then(stub => { + this._terminated = true; + stub.close(); + }); + } + return Promise.resolve(); + } +} diff --git a/owl-bot-staging/v1/src/v1/service_controller_client_config.json b/owl-bot-staging/v1/src/v1/service_controller_client_config.json new file mode 100644 index 0000000..58af282 --- /dev/null +++ b/owl-bot-staging/v1/src/v1/service_controller_client_config.json @@ -0,0 +1,48 @@ +{ + "interfaces": { + "google.api.servicecontrol.v1.ServiceController": { + "retry_codes": { + "non_idempotent": [], + "idempotent": [ + "DEADLINE_EXCEEDED", + "UNAVAILABLE" + ], + "unavailable": [ + "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 + }, + "ce5b960a6ed052e690863808e4f0deff3dc7d49f": { + "initial_retry_delay_millis": 1000, + "retry_delay_multiplier": 1.3, + "max_retry_delay_millis": 10000, + "initial_rpc_timeout_millis": 60000, + "rpc_timeout_multiplier": 1, + "max_rpc_timeout_millis": 60000, + "total_timeout_millis": 600000 + } + }, + "methods": { + "Check": { + "timeout_millis": 5000, + "retry_codes_name": "unavailable", + "retry_params_name": "ce5b960a6ed052e690863808e4f0deff3dc7d49f" + }, + "Report": { + "timeout_millis": 16000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + } + } + } + } +} diff --git a/owl-bot-staging/v1/src/v1/service_controller_proto_list.json b/owl-bot-staging/v1/src/v1/service_controller_proto_list.json new file mode 100644 index 0000000..a93106a --- /dev/null +++ b/owl-bot-staging/v1/src/v1/service_controller_proto_list.json @@ -0,0 +1,11 @@ +[ + "../../protos/google/api/servicecontrol/v1/check_error.proto", + "../../protos/google/api/servicecontrol/v1/distribution.proto", + "../../protos/google/api/servicecontrol/v1/http_request.proto", + "../../protos/google/api/servicecontrol/v1/log_entry.proto", + "../../protos/google/api/servicecontrol/v1/metric_value.proto", + "../../protos/google/api/servicecontrol/v1/operation.proto", + "../../protos/google/api/servicecontrol/v1/quota_controller.proto", + "../../protos/google/api/servicecontrol/v1/service_controller.proto", + "../../protos/google/logging/type/log_severity.proto" +] diff --git a/owl-bot-staging/v1/system-test/fixtures/sample/src/index.js b/owl-bot-staging/v1/system-test/fixtures/sample/src/index.js new file mode 100644 index 0000000..76ec8e2 --- /dev/null +++ b/owl-bot-staging/v1/system-test/fixtures/sample/src/index.js @@ -0,0 +1,28 @@ +// Copyright 2022 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 servicecontrol = require('@google-cloud/service-control'); + +function main() { + const quotaControllerClient = new servicecontrol.QuotaControllerClient(); + const serviceControllerClient = new servicecontrol.ServiceControllerClient(); +} + +main(); diff --git a/owl-bot-staging/v1/system-test/fixtures/sample/src/index.ts b/owl-bot-staging/v1/system-test/fixtures/sample/src/index.ts new file mode 100644 index 0000000..7c3f7a3 --- /dev/null +++ b/owl-bot-staging/v1/system-test/fixtures/sample/src/index.ts @@ -0,0 +1,38 @@ +// Copyright 2022 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 {QuotaControllerClient, ServiceControllerClient} from '@google-cloud/service-control'; + +// check that the client class type name can be used +function doStuffWithQuotaControllerClient(client: QuotaControllerClient) { + client.close(); +} +function doStuffWithServiceControllerClient(client: ServiceControllerClient) { + client.close(); +} + +function main() { + // check that the client instance can be created + const quotaControllerClient = new QuotaControllerClient(); + doStuffWithQuotaControllerClient(quotaControllerClient); + // check that the client instance can be created + const serviceControllerClient = new ServiceControllerClient(); + doStuffWithServiceControllerClient(serviceControllerClient); +} + +main(); diff --git a/owl-bot-staging/v1/system-test/install.ts b/owl-bot-staging/v1/system-test/install.ts new file mode 100644 index 0000000..8ec4522 --- /dev/null +++ b/owl-bot-staging/v1/system-test/install.ts @@ -0,0 +1,49 @@ +// Copyright 2022 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/v1/test/gapic_quota_controller_v1.ts b/owl-bot-staging/v1/test/gapic_quota_controller_v1.ts new file mode 100644 index 0000000..39caa89 --- /dev/null +++ b/owl-bot-staging/v1/test/gapic_quota_controller_v1.ts @@ -0,0 +1,232 @@ +// Copyright 2022 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 quotacontrollerModule from '../src'; + +import {protobuf} from 'google-gax'; + +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); +} + +describe('v1.QuotaControllerClient', () => { + it('has servicePath', () => { + const servicePath = quotacontrollerModule.v1.QuotaControllerClient.servicePath; + assert(servicePath); + }); + + it('has apiEndpoint', () => { + const apiEndpoint = quotacontrollerModule.v1.QuotaControllerClient.apiEndpoint; + assert(apiEndpoint); + }); + + it('has port', () => { + const port = quotacontrollerModule.v1.QuotaControllerClient.port; + assert(port); + assert(typeof port === 'number'); + }); + + it('should create a client with no option', () => { + const client = new quotacontrollerModule.v1.QuotaControllerClient(); + assert(client); + }); + + it('should create a client with gRPC fallback', () => { + const client = new quotacontrollerModule.v1.QuotaControllerClient({ + fallback: true, + }); + assert(client); + }); + + it('has initialize method and supports deferred initialization', async () => { + const client = new quotacontrollerModule.v1.QuotaControllerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + assert.strictEqual(client.quotaControllerStub, undefined); + await client.initialize(); + assert(client.quotaControllerStub); + }); + + it('has close method for the initialized client', done => { + const client = new quotacontrollerModule.v1.QuotaControllerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + assert(client.quotaControllerStub); + client.close().then(() => { + done(); + }); + }); + + it('has close method for the non-initialized client', done => { + const client = new quotacontrollerModule.v1.QuotaControllerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + assert.strictEqual(client.quotaControllerStub, undefined); + client.close().then(() => { + done(); + }); + }); + + it('has getProjectId method', async () => { + const fakeProjectId = 'fake-project-id'; + const client = new quotacontrollerModule.v1.QuotaControllerClient({ + 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 quotacontrollerModule.v1.QuotaControllerClient({ + 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('allocateQuota', () => { + it('invokes allocateQuota without error', async () => { + const client = new quotacontrollerModule.v1.QuotaControllerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.api.servicecontrol.v1.AllocateQuotaRequest()); + request.serviceName = ''; + const expectedHeaderRequestParams = "service_name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.api.servicecontrol.v1.AllocateQuotaResponse()); + client.innerApiCalls.allocateQuota = stubSimpleCall(expectedResponse); + const [response] = await client.allocateQuota(request); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.allocateQuota as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes allocateQuota without error using callback', async () => { + const client = new quotacontrollerModule.v1.QuotaControllerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.api.servicecontrol.v1.AllocateQuotaRequest()); + request.serviceName = ''; + const expectedHeaderRequestParams = "service_name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.api.servicecontrol.v1.AllocateQuotaResponse()); + client.innerApiCalls.allocateQuota = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.allocateQuota( + request, + (err?: Error|null, result?: protos.google.api.servicecontrol.v1.IAllocateQuotaResponse|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.allocateQuota as SinonStub) + .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); + }); + + it('invokes allocateQuota with error', async () => { + const client = new quotacontrollerModule.v1.QuotaControllerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.api.servicecontrol.v1.AllocateQuotaRequest()); + request.serviceName = ''; + const expectedHeaderRequestParams = "service_name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.allocateQuota = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.allocateQuota(request), expectedError); + assert((client.innerApiCalls.allocateQuota as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes allocateQuota with closed client', async () => { + const client = new quotacontrollerModule.v1.QuotaControllerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.api.servicecontrol.v1.AllocateQuotaRequest()); + request.serviceName = ''; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.allocateQuota(request), expectedError); + }); + }); +}); diff --git a/owl-bot-staging/v1/test/gapic_service_controller_v1.ts b/owl-bot-staging/v1/test/gapic_service_controller_v1.ts new file mode 100644 index 0000000..74a01cf --- /dev/null +++ b/owl-bot-staging/v1/test/gapic_service_controller_v1.ts @@ -0,0 +1,329 @@ +// Copyright 2022 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 servicecontrollerModule from '../src'; + +import {protobuf} from 'google-gax'; + +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); +} + +describe('v1.ServiceControllerClient', () => { + it('has servicePath', () => { + const servicePath = servicecontrollerModule.v1.ServiceControllerClient.servicePath; + assert(servicePath); + }); + + it('has apiEndpoint', () => { + const apiEndpoint = servicecontrollerModule.v1.ServiceControllerClient.apiEndpoint; + assert(apiEndpoint); + }); + + it('has port', () => { + const port = servicecontrollerModule.v1.ServiceControllerClient.port; + assert(port); + assert(typeof port === 'number'); + }); + + it('should create a client with no option', () => { + const client = new servicecontrollerModule.v1.ServiceControllerClient(); + assert(client); + }); + + it('should create a client with gRPC fallback', () => { + const client = new servicecontrollerModule.v1.ServiceControllerClient({ + fallback: true, + }); + assert(client); + }); + + it('has initialize method and supports deferred initialization', async () => { + const client = new servicecontrollerModule.v1.ServiceControllerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + assert.strictEqual(client.serviceControllerStub, undefined); + await client.initialize(); + assert(client.serviceControllerStub); + }); + + it('has close method for the initialized client', done => { + const client = new servicecontrollerModule.v1.ServiceControllerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + assert(client.serviceControllerStub); + client.close().then(() => { + done(); + }); + }); + + it('has close method for the non-initialized client', done => { + const client = new servicecontrollerModule.v1.ServiceControllerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + assert.strictEqual(client.serviceControllerStub, undefined); + client.close().then(() => { + done(); + }); + }); + + it('has getProjectId method', async () => { + const fakeProjectId = 'fake-project-id'; + const client = new servicecontrollerModule.v1.ServiceControllerClient({ + 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 servicecontrollerModule.v1.ServiceControllerClient({ + 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('check', () => { + it('invokes check without error', async () => { + const client = new servicecontrollerModule.v1.ServiceControllerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.api.servicecontrol.v1.CheckRequest()); + request.serviceName = ''; + const expectedHeaderRequestParams = "service_name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.api.servicecontrol.v1.CheckResponse()); + client.innerApiCalls.check = stubSimpleCall(expectedResponse); + const [response] = await client.check(request); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.check as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes check without error using callback', async () => { + const client = new servicecontrollerModule.v1.ServiceControllerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.api.servicecontrol.v1.CheckRequest()); + request.serviceName = ''; + const expectedHeaderRequestParams = "service_name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.api.servicecontrol.v1.CheckResponse()); + client.innerApiCalls.check = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.check( + request, + (err?: Error|null, result?: protos.google.api.servicecontrol.v1.ICheckResponse|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.check as SinonStub) + .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); + }); + + it('invokes check with error', async () => { + const client = new servicecontrollerModule.v1.ServiceControllerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.api.servicecontrol.v1.CheckRequest()); + request.serviceName = ''; + const expectedHeaderRequestParams = "service_name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.check = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.check(request), expectedError); + assert((client.innerApiCalls.check as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes check with closed client', async () => { + const client = new servicecontrollerModule.v1.ServiceControllerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.api.servicecontrol.v1.CheckRequest()); + request.serviceName = ''; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.check(request), expectedError); + }); + }); + + describe('report', () => { + it('invokes report without error', async () => { + const client = new servicecontrollerModule.v1.ServiceControllerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.api.servicecontrol.v1.ReportRequest()); + request.serviceName = ''; + const expectedHeaderRequestParams = "service_name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.api.servicecontrol.v1.ReportResponse()); + client.innerApiCalls.report = stubSimpleCall(expectedResponse); + const [response] = await client.report(request); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.report as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes report without error using callback', async () => { + const client = new servicecontrollerModule.v1.ServiceControllerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.api.servicecontrol.v1.ReportRequest()); + request.serviceName = ''; + const expectedHeaderRequestParams = "service_name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.api.servicecontrol.v1.ReportResponse()); + client.innerApiCalls.report = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.report( + request, + (err?: Error|null, result?: protos.google.api.servicecontrol.v1.IReportResponse|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.report as SinonStub) + .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); + }); + + it('invokes report with error', async () => { + const client = new servicecontrollerModule.v1.ServiceControllerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.api.servicecontrol.v1.ReportRequest()); + request.serviceName = ''; + const expectedHeaderRequestParams = "service_name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.report = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.report(request), expectedError); + assert((client.innerApiCalls.report as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes report with closed client', async () => { + const client = new servicecontrollerModule.v1.ServiceControllerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.api.servicecontrol.v1.ReportRequest()); + request.serviceName = ''; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.report(request), expectedError); + }); + }); +}); diff --git a/owl-bot-staging/v1/tsconfig.json b/owl-bot-staging/v1/tsconfig.json new file mode 100644 index 0000000..c78f1c8 --- /dev/null +++ b/owl-bot-staging/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/v1/webpack.config.js b/owl-bot-staging/v1/webpack.config.js new file mode 100644 index 0000000..a206a37 --- /dev/null +++ b/owl-bot-staging/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: 'QuotaController', + filename: './quota-controller.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/owl-bot-staging/v2/.eslintignore b/owl-bot-staging/v2/.eslintignore new file mode 100644 index 0000000..cfc348e --- /dev/null +++ b/owl-bot-staging/v2/.eslintignore @@ -0,0 +1,7 @@ +**/node_modules +**/.coverage +build/ +docs/ +protos/ +system-test/ +samples/generated/ diff --git a/owl-bot-staging/v2/.eslintrc.json b/owl-bot-staging/v2/.eslintrc.json new file mode 100644 index 0000000..7821534 --- /dev/null +++ b/owl-bot-staging/v2/.eslintrc.json @@ -0,0 +1,3 @@ +{ + "extends": "./node_modules/gts" +} diff --git a/owl-bot-staging/v2/.gitignore b/owl-bot-staging/v2/.gitignore new file mode 100644 index 0000000..5d32b23 --- /dev/null +++ b/owl-bot-staging/v2/.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/v2/.jsdoc.js b/owl-bot-staging/v2/.jsdoc.js new file mode 100644 index 0000000..e0f354d --- /dev/null +++ b/owl-bot-staging/v2/.jsdoc.js @@ -0,0 +1,55 @@ +// Copyright 2022 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 2022 Google LLC', + includeDate: false, + sourceFiles: false, + systemName: '@google-cloud/servicecontrol', + theme: 'lumen', + default: { + outputSourceFiles: false + } + }, + markdown: { + idInHeadings: true + } +}; diff --git a/owl-bot-staging/v2/.mocharc.js b/owl-bot-staging/v2/.mocharc.js new file mode 100644 index 0000000..481c522 --- /dev/null +++ b/owl-bot-staging/v2/.mocharc.js @@ -0,0 +1,33 @@ +// Copyright 2022 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/v2/.prettierrc.js b/owl-bot-staging/v2/.prettierrc.js new file mode 100644 index 0000000..494e147 --- /dev/null +++ b/owl-bot-staging/v2/.prettierrc.js @@ -0,0 +1,22 @@ +// Copyright 2022 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/v2/README.md b/owl-bot-staging/v2/README.md new file mode 100644 index 0000000..369bd39 --- /dev/null +++ b/owl-bot-staging/v2/README.md @@ -0,0 +1 @@ +Servicecontrol: Nodejs Client diff --git a/owl-bot-staging/v2/linkinator.config.json b/owl-bot-staging/v2/linkinator.config.json new file mode 100644 index 0000000..befd23c --- /dev/null +++ b/owl-bot-staging/v2/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/v2/package.json b/owl-bot-staging/v2/package.json new file mode 100644 index 0000000..ea4791b --- /dev/null +++ b/owl-bot-staging/v2/package.json @@ -0,0 +1,64 @@ +{ + "name": "@google-cloud/servicecontrol", + "version": "0.1.0", + "description": "Servicecontrol client for Node.js", + "repository": "googleapis/nodejs-servicecontrol", + "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 servicecontrol", + "servicecontrol", + "service controller" + ], + "scripts": { + "clean": "gts clean", + "compile": "tsc -p . && cp -r protos build/", + "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.1.1" + }, + "devDependencies": { + "@types/mocha": "^9.1.0", + "@types/node": "^16.0.0", + "@types/sinon": "^10.0.8", + "c8": "^7.11.0", + "gts": "^3.1.0", + "jsdoc": "^3.6.7", + "jsdoc-fresh": "^1.1.1", + "jsdoc-region-tag": "^1.3.1", + "linkinator": "^3.0.0", + "mocha": "^9.1.4", + "null-loader": "^4.0.1", + "pack-n-play": "^1.0.0-2", + "sinon": "^13.0.0", + "ts-loader": "^9.2.6", + "typescript": "^4.5.5", + "webpack": "^5.67.0", + "webpack-cli": "^4.9.1" + }, + "engines": { + "node": ">=v12" + } +} diff --git a/owl-bot-staging/v2/protos/google/api/servicecontrol/v2/service_controller.proto b/owl-bot-staging/v2/protos/google/api/servicecontrol/v2/service_controller.proto new file mode 100644 index 0000000..2e2112e --- /dev/null +++ b/owl-bot-staging/v2/protos/google/api/servicecontrol/v2/service_controller.proto @@ -0,0 +1,190 @@ +// Copyright 2022 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.api.servicecontrol.v2; + +import "google/api/annotations.proto"; +import "google/api/client.proto"; +import "google/rpc/context/attribute_context.proto"; +import "google/rpc/status.proto"; + +option cc_enable_arenas = true; +option csharp_namespace = "Google.Cloud.ServiceControl.V2"; +option go_package = "google.golang.org/genproto/googleapis/api/servicecontrol/v2;servicecontrol"; +option java_multiple_files = true; +option java_outer_classname = "ServiceControllerProto"; +option java_package = "com.google.api.servicecontrol.v2"; +option objc_class_prefix = "GASC"; +option php_namespace = "Google\\Cloud\\ServiceControl\\V2"; +option ruby_package = "Google::Cloud::ServiceControl::V2"; + +// [Service Control API +// v2](https://cloud.google.com/service-infrastructure/docs/service-control/access-control) +// +// Private Preview. This feature is only available for approved services. +// +// This API provides admission control and telemetry reporting for services +// that are integrated with [Service +// Infrastructure](https://cloud.google.com/service-infrastructure). +service ServiceController { + option (google.api.default_host) = "servicecontrol.googleapis.com"; + option (google.api.oauth_scopes) = + "https://www.googleapis.com/auth/cloud-platform," + "https://www.googleapis.com/auth/servicecontrol"; + + // Private Preview. This feature is only available for approved services. + // + // This method provides admission control for services that are integrated + // with [Service + // Infrastructure](https://cloud.google.com/service-infrastructure). It checks + // whether an operation should be allowed based on the service configuration + // and relevant policies. It must be called before the operation is executed. + // For more information, see + // [Admission + // Control](https://cloud.google.com/service-infrastructure/docs/admission-control). + // + // NOTE: The admission control has an expected policy propagation delay of + // 60s. The caller **must** not depend on the most recent policy changes. + // + // NOTE: The admission control has a hard limit of 1 referenced resources + // per call. If an operation refers to more than 1 resources, the caller + // must call the Check method multiple times. + // + // This method requires the `servicemanagement.services.check` permission + // on the specified service. For more information, see + // [Service Control API Access + // Control](https://cloud.google.com/service-infrastructure/docs/service-control/access-control). + rpc Check(CheckRequest) returns (CheckResponse) { + option (google.api.http) = { + post: "/v2/services/{service_name}:check" + body: "*" + }; + } + + // Private Preview. This feature is only available for approved services. + // + // This method provides telemetry reporting for services that are integrated + // with [Service + // Infrastructure](https://cloud.google.com/service-infrastructure). It + // reports a list of operations that have occurred on a service. It must be + // called after the operations have been executed. For more information, see + // [Telemetry + // Reporting](https://cloud.google.com/service-infrastructure/docs/telemetry-reporting). + // + // NOTE: The telemetry reporting has a hard limit of 1000 operations and 1MB + // per Report call. It is recommended to have no more than 100 operations per + // call. + // + // This method requires the `servicemanagement.services.report` permission + // on the specified service. For more information, see + // [Service Control API Access + // Control](https://cloud.google.com/service-infrastructure/docs/service-control/access-control). + rpc Report(ReportRequest) returns (ReportResponse) { + option (google.api.http) = { + post: "/v2/services/{service_name}:report" + body: "*" + }; + } +} + +// Request message for the Check method. +message CheckRequest { + // The service name as specified in its service configuration. For example, + // `"pubsub.googleapis.com"`. + // + // See + // [google.api.Service](https://cloud.google.com/service-management/reference/rpc/google.api#google.api.Service) + // for the definition of a service name. + string service_name = 1; + + // Specifies the version of the service configuration that should be used to + // process the request. Must not be empty. Set this field to 'latest' to + // specify using the latest configuration. + string service_config_id = 2; + + // Describes attributes about the operation being executed by the service. + google.rpc.context.AttributeContext attributes = 3; + + // Describes the resources and the policies applied to each resource. + repeated ResourceInfo resources = 4; + + // Optional. Contains a comma-separated list of flags. + string flags = 5; +} + +// Describes a resource referenced in the request. +message ResourceInfo { + // The name of the resource referenced in the request. + string name = 1; + + // The resource type in the format of "{service}/{kind}". + string type = 2; + + // The resource permission needed for this request. + // The format must be "{service}/{plural}.{verb}". + string permission = 3; + + // Optional. The identifier of the container of this resource. For Google + // Cloud APIs, the resource container must be one of the following formats: + // - `projects/` + // - `folders/` + // - `organizations/` + // For the policy enforcement on the container level (VPCSC and Location + // Policy check), this field takes precedence on the container extracted from + // name when presents. + string container = 4; + + // Optional. The location of the resource. The value must be a valid zone, + // region or multiregion. For example: "europe-west4" or + // "northamerica-northeast1-a" + string location = 5; +} + +// Response message for the Check method. +message CheckResponse { + // Operation is allowed when this field is not set. Any non-'OK' status + // indicates a denial; [google.rpc.Status.details][google.rpc.Status.details] + // would contain additional details about the denial. + google.rpc.Status status = 1; + + // Returns a set of request contexts generated from the `CheckRequest`. + map headers = 2; +} + +// Request message for the Report method. +message ReportRequest { + // The service name as specified in its service configuration. For example, + // `"pubsub.googleapis.com"`. + // + // See + // [google.api.Service](https://cloud.google.com/service-management/reference/rpc/google.api#google.api.Service) + // for the definition of a service name. + string service_name = 1; + + // Specifies the version of the service configuration that should be used to + // process the request. Must not be empty. Set this field to 'latest' to + // specify using the latest configuration. + string service_config_id = 2; + + // Describes the list of operations to be reported. Each operation is + // represented as an AttributeContext, and contains all attributes around an + // API access. + repeated google.rpc.context.AttributeContext operations = 3; +} + +// Response message for the Report method. +// If the request contains any invalid data, the server returns an RPC error. +message ReportResponse {} diff --git a/owl-bot-staging/v2/samples/generated/v2/service_controller.check.js b/owl-bot-staging/v2/samples/generated/v2/service_controller.check.js new file mode 100644 index 0000000..35fa9a7 --- /dev/null +++ b/owl-bot-staging/v2/samples/generated/v2/service_controller.check.js @@ -0,0 +1,79 @@ +// Copyright 2022 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 servicecontrol_v2_generated_ServiceController_Check_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * The service name as specified in its service configuration. For example, + * `"pubsub.googleapis.com"`. + * See + * google.api.Service (https://cloud.google.com/service-management/reference/rpc/google.api#google.api.Service) + * for the definition of a service name. + */ + // const serviceName = 'abc123' + /** + * Specifies the version of the service configuration that should be used to + * process the request. Must not be empty. Set this field to 'latest' to + * specify using the latest configuration. + */ + // const serviceConfigId = 'abc123' + /** + * Describes attributes about the operation being executed by the service. + */ + // const attributes = {} + /** + * Describes the resources and the policies applied to each resource. + */ + // const resources = 1234 + /** + * Optional. Contains a comma-separated list of flags. + */ + // const flags = 'abc123' + + // Imports the Servicecontrol library + const {ServiceControllerClient} = require('@google-cloud/servicecontrol').v2; + + // Instantiates a client + const servicecontrolClient = new ServiceControllerClient(); + + async function callCheck() { + // Construct request + const request = { + }; + + // Run request + const response = await servicecontrolClient.check(request); + console.log(response); + } + + callCheck(); + // [END servicecontrol_v2_generated_ServiceController_Check_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/v2/samples/generated/v2/service_controller.report.js b/owl-bot-staging/v2/samples/generated/v2/service_controller.report.js new file mode 100644 index 0000000..af0b8c0 --- /dev/null +++ b/owl-bot-staging/v2/samples/generated/v2/service_controller.report.js @@ -0,0 +1,73 @@ +// Copyright 2022 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 servicecontrol_v2_generated_ServiceController_Report_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * The service name as specified in its service configuration. For example, + * `"pubsub.googleapis.com"`. + * See + * google.api.Service (https://cloud.google.com/service-management/reference/rpc/google.api#google.api.Service) + * for the definition of a service name. + */ + // const serviceName = 'abc123' + /** + * Specifies the version of the service configuration that should be used to + * process the request. Must not be empty. Set this field to 'latest' to + * specify using the latest configuration. + */ + // const serviceConfigId = 'abc123' + /** + * Describes the list of operations to be reported. Each operation is + * represented as an AttributeContext, and contains all attributes around an + * API access. + */ + // const operations = 1234 + + // Imports the Servicecontrol library + const {ServiceControllerClient} = require('@google-cloud/servicecontrol').v2; + + // Instantiates a client + const servicecontrolClient = new ServiceControllerClient(); + + async function callReport() { + // Construct request + const request = { + }; + + // Run request + const response = await servicecontrolClient.report(request); + console.log(response); + } + + callReport(); + // [END servicecontrol_v2_generated_ServiceController_Report_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/v2/samples/generated/v2/snippet_metadata.google.api.servicecontrol.v2.json b/owl-bot-staging/v2/samples/generated/v2/snippet_metadata.google.api.servicecontrol.v2.json new file mode 100644 index 0000000..d482e6e --- /dev/null +++ b/owl-bot-staging/v2/samples/generated/v2/snippet_metadata.google.api.servicecontrol.v2.json @@ -0,0 +1,119 @@ +{ + "clientLibrary": { + "name": "nodejs-servicecontrol", + "version": "0.1.0", + "language": "TYPESCRIPT", + "apis": [ + { + "id": "google.api.servicecontrol.v2", + "version": "v2" + } + ] + }, + "snippets": [ + { + "regionTag": "servicecontrol_v2_generated_ServiceController_Check_async", + "title": "ServiceController check Sample", + "origin": "API_DEFINITION", + "description": " Private Preview. This feature is only available for approved services. This method provides admission control for services that are integrated with [Service Infrastructure](https://cloud.google.com/service-infrastructure). It checks whether an operation should be allowed based on the service configuration and relevant policies. It must be called before the operation is executed. For more information, see [Admission Control](https://cloud.google.com/service-infrastructure/docs/admission-control). NOTE: The admission control has an expected policy propagation delay of 60s. The caller **must** not depend on the most recent policy changes. NOTE: The admission control has a hard limit of 1 referenced resources per call. If an operation refers to more than 1 resources, the caller must call the Check method multiple times. This method requires the `servicemanagement.services.check` permission on the specified service. For more information, see [Service Control API Access Control](https://cloud.google.com/service-infrastructure/docs/service-control/access-control).", + "canonical": true, + "file": "service_controller.check.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 71, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "Check", + "fullName": "google.api.servicecontrol.v2.ServiceController.Check", + "async": true, + "parameters": [ + { + "name": "service_name", + "type": "TYPE_STRING" + }, + { + "name": "service_config_id", + "type": "TYPE_STRING" + }, + { + "name": "attributes", + "type": ".google.rpc.context.AttributeContext" + }, + { + "name": "resources", + "type": "TYPE_MESSAGE[]" + }, + { + "name": "flags", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.api.servicecontrol.v2.CheckResponse", + "client": { + "shortName": "ServiceControllerClient", + "fullName": "google.api.servicecontrol.v2.ServiceControllerClient" + }, + "method": { + "shortName": "Check", + "fullName": "google.api.servicecontrol.v2.ServiceController.Check", + "service": { + "shortName": "ServiceController", + "fullName": "google.api.servicecontrol.v2.ServiceController" + } + } + } + }, + { + "regionTag": "servicecontrol_v2_generated_ServiceController_Report_async", + "title": "ServiceController report Sample", + "origin": "API_DEFINITION", + "description": " Private Preview. This feature is only available for approved services. This method provides telemetry reporting for services that are integrated with [Service Infrastructure](https://cloud.google.com/service-infrastructure). It reports a list of operations that have occurred on a service. It must be called after the operations have been executed. For more information, see [Telemetry Reporting](https://cloud.google.com/service-infrastructure/docs/telemetry-reporting). NOTE: The telemetry reporting has a hard limit of 1000 operations and 1MB per Report call. It is recommended to have no more than 100 operations per call. This method requires the `servicemanagement.services.report` permission on the specified service. For more information, see [Service Control API Access Control](https://cloud.google.com/service-infrastructure/docs/service-control/access-control).", + "canonical": true, + "file": "service_controller.report.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 65, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "Report", + "fullName": "google.api.servicecontrol.v2.ServiceController.Report", + "async": true, + "parameters": [ + { + "name": "service_name", + "type": "TYPE_STRING" + }, + { + "name": "service_config_id", + "type": "TYPE_STRING" + }, + { + "name": "operations", + "type": "TYPE_MESSAGE[]" + } + ], + "resultType": ".google.api.servicecontrol.v2.ReportResponse", + "client": { + "shortName": "ServiceControllerClient", + "fullName": "google.api.servicecontrol.v2.ServiceControllerClient" + }, + "method": { + "shortName": "Report", + "fullName": "google.api.servicecontrol.v2.ServiceController.Report", + "service": { + "shortName": "ServiceController", + "fullName": "google.api.servicecontrol.v2.ServiceController" + } + } + } + } + ] +} diff --git a/owl-bot-staging/v2/src/index.ts b/owl-bot-staging/v2/src/index.ts new file mode 100644 index 0000000..8f96cd6 --- /dev/null +++ b/owl-bot-staging/v2/src/index.ts @@ -0,0 +1,25 @@ +// Copyright 2022 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 v2 from './v2'; +const ServiceControllerClient = v2.ServiceControllerClient; +type ServiceControllerClient = v2.ServiceControllerClient; +export {v2, ServiceControllerClient}; +export default {v2, ServiceControllerClient}; +import * as protos from '../protos/protos'; +export {protos} diff --git a/owl-bot-staging/v2/src/v2/gapic_metadata.json b/owl-bot-staging/v2/src/v2/gapic_metadata.json new file mode 100644 index 0000000..1345b12 --- /dev/null +++ b/owl-bot-staging/v2/src/v2/gapic_metadata.json @@ -0,0 +1,43 @@ +{ + "schema": "1.0", + "comment": "This file maps proto services/RPCs to the corresponding library clients/methods", + "language": "typescript", + "protoPackage": "google.api.servicecontrol.v2", + "libraryPackage": "@google-cloud/servicecontrol", + "services": { + "ServiceController": { + "clients": { + "grpc": { + "libraryClient": "ServiceControllerClient", + "rpcs": { + "Check": { + "methods": [ + "check" + ] + }, + "Report": { + "methods": [ + "report" + ] + } + } + }, + "grpc-fallback": { + "libraryClient": "ServiceControllerClient", + "rpcs": { + "Check": { + "methods": [ + "check" + ] + }, + "Report": { + "methods": [ + "report" + ] + } + } + } + } + } + } +} diff --git a/owl-bot-staging/v2/src/v2/index.ts b/owl-bot-staging/v2/src/v2/index.ts new file mode 100644 index 0000000..f77402c --- /dev/null +++ b/owl-bot-staging/v2/src/v2/index.ts @@ -0,0 +1,19 @@ +// Copyright 2022 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 {ServiceControllerClient} from './service_controller_client'; diff --git a/owl-bot-staging/v2/src/v2/service_controller_client.ts b/owl-bot-staging/v2/src/v2/service_controller_client.ts new file mode 100644 index 0000000..4df9b46 --- /dev/null +++ b/owl-bot-staging/v2/src/v2/service_controller_client.ts @@ -0,0 +1,508 @@ +// Copyright 2022 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 * as gax from 'google-gax'; +import {Callback, CallOptions, Descriptors, ClientOptions} from 'google-gax'; + +import * as protos from '../../protos/protos'; +import jsonProtos = require('../../protos/protos.json'); +/** + * Client JSON configuration object, loaded from + * `src/v2/service_controller_client_config.json`. + * This file defines retry strategy and timeouts for all API methods in this library. + */ +import * as gapicConfig from './service_controller_client_config.json'; + +const version = require('../../../package.json').version; + +/** + * [Service Control API + * v2](https://cloud.google.com/service-infrastructure/docs/service-control/access-control) + * + * Private Preview. This feature is only available for approved services. + * + * This API provides admission control and telemetry reporting for services + * that are integrated with [Service + * Infrastructure](https://cloud.google.com/service-infrastructure). + * @class + * @memberof v2 + */ +export class ServiceControllerClient { + 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}; + serviceControllerStub?: Promise<{[name: string]: Function}>; + + /** + * Construct an instance of ServiceControllerClient. + * + * @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}. + */ + constructor(opts?: ClientOptions) { + // Ensure that options include all the required fields. + const staticMembers = this.constructor as typeof ServiceControllerClient; + 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); + + // 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; + } + + // Choose either gRPC or proto-over-HTTP implementation of google-gax. + this._gaxModule = opts.fallback ? gax.fallback : gax; + + // 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); + + // Put together the default options sent with requests. + this._defaults = this._gaxGrpc.constructSettings( + 'google.api.servicecontrol.v2.ServiceController', 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 = gax.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.serviceControllerStub) { + return this.serviceControllerStub; + } + + // Put together the "service stub" for + // google.api.servicecontrol.v2.ServiceController. + this.serviceControllerStub = this._gaxGrpc.createStub( + this._opts.fallback ? + (this._protos as protobuf.Root).lookupService('google.api.servicecontrol.v2.ServiceController') : + // eslint-disable-next-line @typescript-eslint/no-explicit-any + (this._protos as any).google.api.servicecontrol.v2.ServiceController, + 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 serviceControllerStubMethods = + ['check', 'report']; + for (const methodName of serviceControllerStubMethods) { + const callPromise = this.serviceControllerStub.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 = + undefined; + const apiCall = this._gaxModule.createApiCall( + callPromise, + this._defaults[methodName], + descriptor + ); + + this.innerApiCalls[methodName] = apiCall; + } + + return this.serviceControllerStub; + } + + /** + * The DNS address for this API service. + * @returns {string} The DNS address for this service. + */ + static get servicePath() { + return 'servicecontrol.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 'servicecontrol.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/cloud-platform', + 'https://www.googleapis.com/auth/servicecontrol' + ]; + } + + 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 -- + // ------------------- +/** + * Private Preview. This feature is only available for approved services. + * + * This method provides admission control for services that are integrated + * with [Service + * Infrastructure](https://cloud.google.com/service-infrastructure). It checks + * whether an operation should be allowed based on the service configuration + * and relevant policies. It must be called before the operation is executed. + * For more information, see + * [Admission + * Control](https://cloud.google.com/service-infrastructure/docs/admission-control). + * + * NOTE: The admission control has an expected policy propagation delay of + * 60s. The caller **must** not depend on the most recent policy changes. + * + * NOTE: The admission control has a hard limit of 1 referenced resources + * per call. If an operation refers to more than 1 resources, the caller + * must call the Check method multiple times. + * + * This method requires the `servicemanagement.services.check` permission + * on the specified service. For more information, see + * [Service Control API Access + * Control](https://cloud.google.com/service-infrastructure/docs/service-control/access-control). + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.serviceName + * The service name as specified in its service configuration. For example, + * `"pubsub.googleapis.com"`. + * + * See + * [google.api.Service](https://cloud.google.com/service-management/reference/rpc/google.api#google.api.Service) + * for the definition of a service name. + * @param {string} request.serviceConfigId + * Specifies the version of the service configuration that should be used to + * process the request. Must not be empty. Set this field to 'latest' to + * specify using the latest configuration. + * @param {google.rpc.context.AttributeContext} request.attributes + * Describes attributes about the operation being executed by the service. + * @param {number[]} request.resources + * Describes the resources and the policies applied to each resource. + * @param {string} request.flags + * Optional. Contains a comma-separated list of flags. + * @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 [CheckResponse]{@link google.api.servicecontrol.v2.CheckResponse}. + * 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/v2/service_controller.check.js + * region_tag:servicecontrol_v2_generated_ServiceController_Check_async + */ + check( + request?: protos.google.api.servicecontrol.v2.ICheckRequest, + options?: CallOptions): + Promise<[ + protos.google.api.servicecontrol.v2.ICheckResponse, + protos.google.api.servicecontrol.v2.ICheckRequest|undefined, {}|undefined + ]>; + check( + request: protos.google.api.servicecontrol.v2.ICheckRequest, + options: CallOptions, + callback: Callback< + protos.google.api.servicecontrol.v2.ICheckResponse, + protos.google.api.servicecontrol.v2.ICheckRequest|null|undefined, + {}|null|undefined>): void; + check( + request: protos.google.api.servicecontrol.v2.ICheckRequest, + callback: Callback< + protos.google.api.servicecontrol.v2.ICheckResponse, + protos.google.api.servicecontrol.v2.ICheckRequest|null|undefined, + {}|null|undefined>): void; + check( + request?: protos.google.api.servicecontrol.v2.ICheckRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.api.servicecontrol.v2.ICheckResponse, + protos.google.api.servicecontrol.v2.ICheckRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.api.servicecontrol.v2.ICheckResponse, + protos.google.api.servicecontrol.v2.ICheckRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.api.servicecontrol.v2.ICheckResponse, + protos.google.api.servicecontrol.v2.ICheckRequest|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' + ] = gax.routingHeader.fromParams({ + 'service_name': request.serviceName || '', + }); + this.initialize(); + return this.innerApiCalls.check(request, options, callback); + } +/** + * Private Preview. This feature is only available for approved services. + * + * This method provides telemetry reporting for services that are integrated + * with [Service + * Infrastructure](https://cloud.google.com/service-infrastructure). It + * reports a list of operations that have occurred on a service. It must be + * called after the operations have been executed. For more information, see + * [Telemetry + * Reporting](https://cloud.google.com/service-infrastructure/docs/telemetry-reporting). + * + * NOTE: The telemetry reporting has a hard limit of 1000 operations and 1MB + * per Report call. It is recommended to have no more than 100 operations per + * call. + * + * This method requires the `servicemanagement.services.report` permission + * on the specified service. For more information, see + * [Service Control API Access + * Control](https://cloud.google.com/service-infrastructure/docs/service-control/access-control). + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.serviceName + * The service name as specified in its service configuration. For example, + * `"pubsub.googleapis.com"`. + * + * See + * [google.api.Service](https://cloud.google.com/service-management/reference/rpc/google.api#google.api.Service) + * for the definition of a service name. + * @param {string} request.serviceConfigId + * Specifies the version of the service configuration that should be used to + * process the request. Must not be empty. Set this field to 'latest' to + * specify using the latest configuration. + * @param {number[]} request.operations + * Describes the list of operations to be reported. Each operation is + * represented as an AttributeContext, and contains all attributes around an + * API access. + * @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 [ReportResponse]{@link google.api.servicecontrol.v2.ReportResponse}. + * 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/v2/service_controller.report.js + * region_tag:servicecontrol_v2_generated_ServiceController_Report_async + */ + report( + request?: protos.google.api.servicecontrol.v2.IReportRequest, + options?: CallOptions): + Promise<[ + protos.google.api.servicecontrol.v2.IReportResponse, + protos.google.api.servicecontrol.v2.IReportRequest|undefined, {}|undefined + ]>; + report( + request: protos.google.api.servicecontrol.v2.IReportRequest, + options: CallOptions, + callback: Callback< + protos.google.api.servicecontrol.v2.IReportResponse, + protos.google.api.servicecontrol.v2.IReportRequest|null|undefined, + {}|null|undefined>): void; + report( + request: protos.google.api.servicecontrol.v2.IReportRequest, + callback: Callback< + protos.google.api.servicecontrol.v2.IReportResponse, + protos.google.api.servicecontrol.v2.IReportRequest|null|undefined, + {}|null|undefined>): void; + report( + request?: protos.google.api.servicecontrol.v2.IReportRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.api.servicecontrol.v2.IReportResponse, + protos.google.api.servicecontrol.v2.IReportRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.api.servicecontrol.v2.IReportResponse, + protos.google.api.servicecontrol.v2.IReportRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.api.servicecontrol.v2.IReportResponse, + protos.google.api.servicecontrol.v2.IReportRequest|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' + ] = gax.routingHeader.fromParams({ + 'service_name': request.serviceName || '', + }); + this.initialize(); + return this.innerApiCalls.report(request, options, callback); + } + + + /** + * 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.serviceControllerStub && !this._terminated) { + return this.serviceControllerStub.then(stub => { + this._terminated = true; + stub.close(); + }); + } + return Promise.resolve(); + } +} diff --git a/owl-bot-staging/v2/src/v2/service_controller_client_config.json b/owl-bot-staging/v2/src/v2/service_controller_client_config.json new file mode 100644 index 0000000..eb8eeeb --- /dev/null +++ b/owl-bot-staging/v2/src/v2/service_controller_client_config.json @@ -0,0 +1,47 @@ +{ + "interfaces": { + "google.api.servicecontrol.v2.ServiceController": { + "retry_codes": { + "non_idempotent": [], + "idempotent": [ + "DEADLINE_EXCEEDED", + "UNAVAILABLE" + ], + "unavailable": [ + "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 + }, + "ce5b960a6ed052e690863808e4f0deff3dc7d49f": { + "initial_retry_delay_millis": 1000, + "retry_delay_multiplier": 1.3, + "max_retry_delay_millis": 10000, + "initial_rpc_timeout_millis": 60000, + "rpc_timeout_multiplier": 1, + "max_rpc_timeout_millis": 60000, + "total_timeout_millis": 600000 + } + }, + "methods": { + "Check": { + "timeout_millis": 5000, + "retry_codes_name": "unavailable", + "retry_params_name": "ce5b960a6ed052e690863808e4f0deff3dc7d49f" + }, + "Report": { + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + } + } + } + } +} diff --git a/owl-bot-staging/v2/src/v2/service_controller_proto_list.json b/owl-bot-staging/v2/src/v2/service_controller_proto_list.json new file mode 100644 index 0000000..dda310a --- /dev/null +++ b/owl-bot-staging/v2/src/v2/service_controller_proto_list.json @@ -0,0 +1,3 @@ +[ + "../../protos/google/api/servicecontrol/v2/service_controller.proto" +] diff --git a/owl-bot-staging/v2/system-test/fixtures/sample/src/index.js b/owl-bot-staging/v2/system-test/fixtures/sample/src/index.js new file mode 100644 index 0000000..f8c9135 --- /dev/null +++ b/owl-bot-staging/v2/system-test/fixtures/sample/src/index.js @@ -0,0 +1,27 @@ +// Copyright 2022 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 servicecontrol = require('@google-cloud/servicecontrol'); + +function main() { + const serviceControllerClient = new servicecontrol.ServiceControllerClient(); +} + +main(); diff --git a/owl-bot-staging/v2/system-test/fixtures/sample/src/index.ts b/owl-bot-staging/v2/system-test/fixtures/sample/src/index.ts new file mode 100644 index 0000000..9750f7b --- /dev/null +++ b/owl-bot-staging/v2/system-test/fixtures/sample/src/index.ts @@ -0,0 +1,32 @@ +// Copyright 2022 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 {ServiceControllerClient} from '@google-cloud/servicecontrol'; + +// check that the client class type name can be used +function doStuffWithServiceControllerClient(client: ServiceControllerClient) { + client.close(); +} + +function main() { + // check that the client instance can be created + const serviceControllerClient = new ServiceControllerClient(); + doStuffWithServiceControllerClient(serviceControllerClient); +} + +main(); diff --git a/owl-bot-staging/v2/system-test/install.ts b/owl-bot-staging/v2/system-test/install.ts new file mode 100644 index 0000000..8ec4522 --- /dev/null +++ b/owl-bot-staging/v2/system-test/install.ts @@ -0,0 +1,49 @@ +// Copyright 2022 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/v2/test/gapic_service_controller_v2.ts b/owl-bot-staging/v2/test/gapic_service_controller_v2.ts new file mode 100644 index 0000000..d7f03ed --- /dev/null +++ b/owl-bot-staging/v2/test/gapic_service_controller_v2.ts @@ -0,0 +1,329 @@ +// Copyright 2022 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 servicecontrollerModule from '../src'; + +import {protobuf} from 'google-gax'; + +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); +} + +describe('v2.ServiceControllerClient', () => { + it('has servicePath', () => { + const servicePath = servicecontrollerModule.v2.ServiceControllerClient.servicePath; + assert(servicePath); + }); + + it('has apiEndpoint', () => { + const apiEndpoint = servicecontrollerModule.v2.ServiceControllerClient.apiEndpoint; + assert(apiEndpoint); + }); + + it('has port', () => { + const port = servicecontrollerModule.v2.ServiceControllerClient.port; + assert(port); + assert(typeof port === 'number'); + }); + + it('should create a client with no option', () => { + const client = new servicecontrollerModule.v2.ServiceControllerClient(); + assert(client); + }); + + it('should create a client with gRPC fallback', () => { + const client = new servicecontrollerModule.v2.ServiceControllerClient({ + fallback: true, + }); + assert(client); + }); + + it('has initialize method and supports deferred initialization', async () => { + const client = new servicecontrollerModule.v2.ServiceControllerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + assert.strictEqual(client.serviceControllerStub, undefined); + await client.initialize(); + assert(client.serviceControllerStub); + }); + + it('has close method for the initialized client', done => { + const client = new servicecontrollerModule.v2.ServiceControllerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + assert(client.serviceControllerStub); + client.close().then(() => { + done(); + }); + }); + + it('has close method for the non-initialized client', done => { + const client = new servicecontrollerModule.v2.ServiceControllerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + assert.strictEqual(client.serviceControllerStub, undefined); + client.close().then(() => { + done(); + }); + }); + + it('has getProjectId method', async () => { + const fakeProjectId = 'fake-project-id'; + const client = new servicecontrollerModule.v2.ServiceControllerClient({ + 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 servicecontrollerModule.v2.ServiceControllerClient({ + 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('check', () => { + it('invokes check without error', async () => { + const client = new servicecontrollerModule.v2.ServiceControllerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.api.servicecontrol.v2.CheckRequest()); + request.serviceName = ''; + const expectedHeaderRequestParams = "service_name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.api.servicecontrol.v2.CheckResponse()); + client.innerApiCalls.check = stubSimpleCall(expectedResponse); + const [response] = await client.check(request); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.check as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes check without error using callback', async () => { + const client = new servicecontrollerModule.v2.ServiceControllerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.api.servicecontrol.v2.CheckRequest()); + request.serviceName = ''; + const expectedHeaderRequestParams = "service_name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.api.servicecontrol.v2.CheckResponse()); + client.innerApiCalls.check = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.check( + request, + (err?: Error|null, result?: protos.google.api.servicecontrol.v2.ICheckResponse|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.check as SinonStub) + .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); + }); + + it('invokes check with error', async () => { + const client = new servicecontrollerModule.v2.ServiceControllerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.api.servicecontrol.v2.CheckRequest()); + request.serviceName = ''; + const expectedHeaderRequestParams = "service_name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.check = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.check(request), expectedError); + assert((client.innerApiCalls.check as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes check with closed client', async () => { + const client = new servicecontrollerModule.v2.ServiceControllerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.api.servicecontrol.v2.CheckRequest()); + request.serviceName = ''; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.check(request), expectedError); + }); + }); + + describe('report', () => { + it('invokes report without error', async () => { + const client = new servicecontrollerModule.v2.ServiceControllerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.api.servicecontrol.v2.ReportRequest()); + request.serviceName = ''; + const expectedHeaderRequestParams = "service_name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.api.servicecontrol.v2.ReportResponse()); + client.innerApiCalls.report = stubSimpleCall(expectedResponse); + const [response] = await client.report(request); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.report as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes report without error using callback', async () => { + const client = new servicecontrollerModule.v2.ServiceControllerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.api.servicecontrol.v2.ReportRequest()); + request.serviceName = ''; + const expectedHeaderRequestParams = "service_name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.api.servicecontrol.v2.ReportResponse()); + client.innerApiCalls.report = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.report( + request, + (err?: Error|null, result?: protos.google.api.servicecontrol.v2.IReportResponse|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.report as SinonStub) + .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); + }); + + it('invokes report with error', async () => { + const client = new servicecontrollerModule.v2.ServiceControllerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.api.servicecontrol.v2.ReportRequest()); + request.serviceName = ''; + const expectedHeaderRequestParams = "service_name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.report = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.report(request), expectedError); + assert((client.innerApiCalls.report as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes report with closed client', async () => { + const client = new servicecontrollerModule.v2.ServiceControllerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.api.servicecontrol.v2.ReportRequest()); + request.serviceName = ''; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.report(request), expectedError); + }); + }); +}); diff --git a/owl-bot-staging/v2/tsconfig.json b/owl-bot-staging/v2/tsconfig.json new file mode 100644 index 0000000..c78f1c8 --- /dev/null +++ b/owl-bot-staging/v2/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/v2/webpack.config.js b/owl-bot-staging/v2/webpack.config.js new file mode 100644 index 0000000..54d59d9 --- /dev/null +++ b/owl-bot-staging/v2/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: 'ServiceController', + filename: './service-controller.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 c768060b58e744367950ca6c91a3aab7dd67aee7 Mon Sep 17 00:00:00 2001 From: Owl Bot Date: Fri, 24 Jun 2022 10:03:38 +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 --- owl-bot-staging/v1/.eslintignore | 7 - owl-bot-staging/v1/.eslintrc.json | 3 - owl-bot-staging/v1/.gitignore | 14 - owl-bot-staging/v1/.jsdoc.js | 55 -- owl-bot-staging/v1/.mocharc.js | 33 -- owl-bot-staging/v1/.prettierrc.js | 22 - owl-bot-staging/v1/README.md | 1 - owl-bot-staging/v1/linkinator.config.json | 16 - owl-bot-staging/v1/package.json | 65 --- .../api/servicecontrol/v1/check_error.proto | 124 ----- .../api/servicecontrol/v1/distribution.proto | 166 ------ .../api/servicecontrol/v1/http_request.proto | 93 ---- .../api/servicecontrol/v1/log_entry.proto | 126 ----- .../api/servicecontrol/v1/metric_value.proto | 81 --- .../api/servicecontrol/v1/operation.proto | 123 ----- .../servicecontrol/v1/quota_controller.proto | 245 --------- .../v1/service_controller.proto | 256 --------- .../google/logging/type/http_request.proto | 95 ---- .../google/logging/type/log_severity.proto | 71 --- .../v1/quota_controller.allocate_quota.js | 69 --- .../generated/v1/service_controller.check.js | 72 --- .../generated/v1/service_controller.report.js | 80 --- ...metadata.google.api.servicecontrol.v1.json | 159 ------ owl-bot-staging/v1/src/index.ts | 27 - owl-bot-staging/v1/src/v1/gapic_metadata.json | 67 --- owl-bot-staging/v1/src/v1/index.ts | 20 - .../v1/src/v1/quota_controller_client.ts | 386 ------------- .../v1/quota_controller_client_config.json | 30 -- .../src/v1/quota_controller_proto_list.json | 11 - .../v1/src/v1/service_controller_client.ts | 504 ----------------- .../v1/service_controller_client_config.json | 48 -- .../src/v1/service_controller_proto_list.json | 11 - .../system-test/fixtures/sample/src/index.js | 28 - .../system-test/fixtures/sample/src/index.ts | 38 -- owl-bot-staging/v1/system-test/install.ts | 49 -- .../v1/test/gapic_quota_controller_v1.ts | 232 -------- .../v1/test/gapic_service_controller_v1.ts | 329 ------------ owl-bot-staging/v1/tsconfig.json | 19 - owl-bot-staging/v1/webpack.config.js | 64 --- owl-bot-staging/v2/.eslintignore | 7 - owl-bot-staging/v2/.eslintrc.json | 3 - owl-bot-staging/v2/.gitignore | 14 - owl-bot-staging/v2/.jsdoc.js | 55 -- owl-bot-staging/v2/.mocharc.js | 33 -- owl-bot-staging/v2/.prettierrc.js | 22 - owl-bot-staging/v2/README.md | 1 - owl-bot-staging/v2/linkinator.config.json | 16 - owl-bot-staging/v2/package.json | 64 --- .../v2/service_controller.proto | 190 ------- .../generated/v2/service_controller.check.js | 79 --- .../generated/v2/service_controller.report.js | 73 --- ...metadata.google.api.servicecontrol.v2.json | 119 ---- owl-bot-staging/v2/src/index.ts | 25 - owl-bot-staging/v2/src/v2/gapic_metadata.json | 43 -- owl-bot-staging/v2/src/v2/index.ts | 19 - .../v2/src/v2/service_controller_client.ts | 508 ------------------ .../v2/service_controller_client_config.json | 47 -- .../src/v2/service_controller_proto_list.json | 3 - .../system-test/fixtures/sample/src/index.js | 27 - .../system-test/fixtures/sample/src/index.ts | 32 -- owl-bot-staging/v2/system-test/install.ts | 49 -- .../v2/test/gapic_service_controller_v2.ts | 329 ------------ owl-bot-staging/v2/tsconfig.json | 19 - owl-bot-staging/v2/webpack.config.js | 64 --- src/v1/quota_controller_client.ts | 11 +- src/v1/service_controller_client.ts | 11 +- src/v2/service_controller_client.ts | 11 +- 67 files changed, 15 insertions(+), 5698 deletions(-) delete mode 100644 owl-bot-staging/v1/.eslintignore delete mode 100644 owl-bot-staging/v1/.eslintrc.json delete mode 100644 owl-bot-staging/v1/.gitignore delete mode 100644 owl-bot-staging/v1/.jsdoc.js delete mode 100644 owl-bot-staging/v1/.mocharc.js delete mode 100644 owl-bot-staging/v1/.prettierrc.js delete mode 100644 owl-bot-staging/v1/README.md delete mode 100644 owl-bot-staging/v1/linkinator.config.json delete mode 100644 owl-bot-staging/v1/package.json delete mode 100644 owl-bot-staging/v1/protos/google/api/servicecontrol/v1/check_error.proto delete mode 100644 owl-bot-staging/v1/protos/google/api/servicecontrol/v1/distribution.proto delete mode 100644 owl-bot-staging/v1/protos/google/api/servicecontrol/v1/http_request.proto delete mode 100644 owl-bot-staging/v1/protos/google/api/servicecontrol/v1/log_entry.proto delete mode 100644 owl-bot-staging/v1/protos/google/api/servicecontrol/v1/metric_value.proto delete mode 100644 owl-bot-staging/v1/protos/google/api/servicecontrol/v1/operation.proto delete mode 100644 owl-bot-staging/v1/protos/google/api/servicecontrol/v1/quota_controller.proto delete mode 100644 owl-bot-staging/v1/protos/google/api/servicecontrol/v1/service_controller.proto delete mode 100644 owl-bot-staging/v1/protos/google/logging/type/http_request.proto delete mode 100644 owl-bot-staging/v1/protos/google/logging/type/log_severity.proto delete mode 100644 owl-bot-staging/v1/samples/generated/v1/quota_controller.allocate_quota.js delete mode 100644 owl-bot-staging/v1/samples/generated/v1/service_controller.check.js delete mode 100644 owl-bot-staging/v1/samples/generated/v1/service_controller.report.js delete mode 100644 owl-bot-staging/v1/samples/generated/v1/snippet_metadata.google.api.servicecontrol.v1.json delete mode 100644 owl-bot-staging/v1/src/index.ts delete mode 100644 owl-bot-staging/v1/src/v1/gapic_metadata.json delete mode 100644 owl-bot-staging/v1/src/v1/index.ts delete mode 100644 owl-bot-staging/v1/src/v1/quota_controller_client.ts delete mode 100644 owl-bot-staging/v1/src/v1/quota_controller_client_config.json delete mode 100644 owl-bot-staging/v1/src/v1/quota_controller_proto_list.json delete mode 100644 owl-bot-staging/v1/src/v1/service_controller_client.ts delete mode 100644 owl-bot-staging/v1/src/v1/service_controller_client_config.json delete mode 100644 owl-bot-staging/v1/src/v1/service_controller_proto_list.json delete mode 100644 owl-bot-staging/v1/system-test/fixtures/sample/src/index.js delete mode 100644 owl-bot-staging/v1/system-test/fixtures/sample/src/index.ts delete mode 100644 owl-bot-staging/v1/system-test/install.ts delete mode 100644 owl-bot-staging/v1/test/gapic_quota_controller_v1.ts delete mode 100644 owl-bot-staging/v1/test/gapic_service_controller_v1.ts delete mode 100644 owl-bot-staging/v1/tsconfig.json delete mode 100644 owl-bot-staging/v1/webpack.config.js delete mode 100644 owl-bot-staging/v2/.eslintignore delete mode 100644 owl-bot-staging/v2/.eslintrc.json delete mode 100644 owl-bot-staging/v2/.gitignore delete mode 100644 owl-bot-staging/v2/.jsdoc.js delete mode 100644 owl-bot-staging/v2/.mocharc.js delete mode 100644 owl-bot-staging/v2/.prettierrc.js delete mode 100644 owl-bot-staging/v2/README.md delete mode 100644 owl-bot-staging/v2/linkinator.config.json delete mode 100644 owl-bot-staging/v2/package.json delete mode 100644 owl-bot-staging/v2/protos/google/api/servicecontrol/v2/service_controller.proto delete mode 100644 owl-bot-staging/v2/samples/generated/v2/service_controller.check.js delete mode 100644 owl-bot-staging/v2/samples/generated/v2/service_controller.report.js delete mode 100644 owl-bot-staging/v2/samples/generated/v2/snippet_metadata.google.api.servicecontrol.v2.json delete mode 100644 owl-bot-staging/v2/src/index.ts delete mode 100644 owl-bot-staging/v2/src/v2/gapic_metadata.json delete mode 100644 owl-bot-staging/v2/src/v2/index.ts delete mode 100644 owl-bot-staging/v2/src/v2/service_controller_client.ts delete mode 100644 owl-bot-staging/v2/src/v2/service_controller_client_config.json delete mode 100644 owl-bot-staging/v2/src/v2/service_controller_proto_list.json delete mode 100644 owl-bot-staging/v2/system-test/fixtures/sample/src/index.js delete mode 100644 owl-bot-staging/v2/system-test/fixtures/sample/src/index.ts delete mode 100644 owl-bot-staging/v2/system-test/install.ts delete mode 100644 owl-bot-staging/v2/test/gapic_service_controller_v2.ts delete mode 100644 owl-bot-staging/v2/tsconfig.json delete mode 100644 owl-bot-staging/v2/webpack.config.js diff --git a/owl-bot-staging/v1/.eslintignore b/owl-bot-staging/v1/.eslintignore deleted file mode 100644 index cfc348e..0000000 --- a/owl-bot-staging/v1/.eslintignore +++ /dev/null @@ -1,7 +0,0 @@ -**/node_modules -**/.coverage -build/ -docs/ -protos/ -system-test/ -samples/generated/ diff --git a/owl-bot-staging/v1/.eslintrc.json b/owl-bot-staging/v1/.eslintrc.json deleted file mode 100644 index 7821534..0000000 --- a/owl-bot-staging/v1/.eslintrc.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "extends": "./node_modules/gts" -} diff --git a/owl-bot-staging/v1/.gitignore b/owl-bot-staging/v1/.gitignore deleted file mode 100644 index 5d32b23..0000000 --- a/owl-bot-staging/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/v1/.jsdoc.js b/owl-bot-staging/v1/.jsdoc.js deleted file mode 100644 index 87ec09c..0000000 --- a/owl-bot-staging/v1/.jsdoc.js +++ /dev/null @@ -1,55 +0,0 @@ -// Copyright 2022 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 2022 Google LLC', - includeDate: false, - sourceFiles: false, - systemName: '@google-cloud/service-control', - theme: 'lumen', - default: { - outputSourceFiles: false - } - }, - markdown: { - idInHeadings: true - } -}; diff --git a/owl-bot-staging/v1/.mocharc.js b/owl-bot-staging/v1/.mocharc.js deleted file mode 100644 index 481c522..0000000 --- a/owl-bot-staging/v1/.mocharc.js +++ /dev/null @@ -1,33 +0,0 @@ -// Copyright 2022 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/v1/.prettierrc.js b/owl-bot-staging/v1/.prettierrc.js deleted file mode 100644 index 494e147..0000000 --- a/owl-bot-staging/v1/.prettierrc.js +++ /dev/null @@ -1,22 +0,0 @@ -// Copyright 2022 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/v1/README.md b/owl-bot-staging/v1/README.md deleted file mode 100644 index 369bd39..0000000 --- a/owl-bot-staging/v1/README.md +++ /dev/null @@ -1 +0,0 @@ -Servicecontrol: Nodejs Client diff --git a/owl-bot-staging/v1/linkinator.config.json b/owl-bot-staging/v1/linkinator.config.json deleted file mode 100644 index befd23c..0000000 --- a/owl-bot-staging/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/v1/package.json b/owl-bot-staging/v1/package.json deleted file mode 100644 index bd2371a..0000000 --- a/owl-bot-staging/v1/package.json +++ /dev/null @@ -1,65 +0,0 @@ -{ - "name": "@google-cloud/service-control", - "version": "0.1.0", - "description": "Servicecontrol client for Node.js", - "repository": "googleapis/nodejs-servicecontrol", - "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 servicecontrol", - "servicecontrol", - "quota controller", - "service controller" - ], - "scripts": { - "clean": "gts clean", - "compile": "tsc -p . && cp -r protos build/", - "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.1.1" - }, - "devDependencies": { - "@types/mocha": "^9.1.0", - "@types/node": "^16.0.0", - "@types/sinon": "^10.0.8", - "c8": "^7.11.0", - "gts": "^3.1.0", - "jsdoc": "^3.6.7", - "jsdoc-fresh": "^1.1.1", - "jsdoc-region-tag": "^1.3.1", - "linkinator": "^3.0.0", - "mocha": "^9.1.4", - "null-loader": "^4.0.1", - "pack-n-play": "^1.0.0-2", - "sinon": "^13.0.0", - "ts-loader": "^9.2.6", - "typescript": "^4.5.5", - "webpack": "^5.67.0", - "webpack-cli": "^4.9.1" - }, - "engines": { - "node": ">=v12" - } -} diff --git a/owl-bot-staging/v1/protos/google/api/servicecontrol/v1/check_error.proto b/owl-bot-staging/v1/protos/google/api/servicecontrol/v1/check_error.proto deleted file mode 100644 index 4f63471..0000000 --- a/owl-bot-staging/v1/protos/google/api/servicecontrol/v1/check_error.proto +++ /dev/null @@ -1,124 +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 -// -// 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.api.servicecontrol.v1; - -import "google/rpc/status.proto"; - -option cc_enable_arenas = true; -option csharp_namespace = "Google.Cloud.ServiceControl.V1"; -option go_package = "google.golang.org/genproto/googleapis/api/servicecontrol/v1;servicecontrol"; -option java_multiple_files = true; -option java_outer_classname = "CheckErrorProto"; -option java_package = "com.google.api.servicecontrol.v1"; -option php_namespace = "Google\\Cloud\\ServiceControl\\V1"; -option ruby_package = "Google::Cloud::ServiceControl::V1"; - -// Defines the errors to be returned in -// [google.api.servicecontrol.v1.CheckResponse.check_errors][google.api.servicecontrol.v1.CheckResponse.check_errors]. -message CheckError { - // Error codes for Check responses. - enum Code { - // This is never used in `CheckResponse`. - ERROR_CODE_UNSPECIFIED = 0; - - // The consumer's project id, network container, or resource container was - // not found. Same as [google.rpc.Code.NOT_FOUND][google.rpc.Code.NOT_FOUND]. - NOT_FOUND = 5; - - // The consumer doesn't have access to the specified resource. - // Same as [google.rpc.Code.PERMISSION_DENIED][google.rpc.Code.PERMISSION_DENIED]. - PERMISSION_DENIED = 7; - - // Quota check failed. Same as [google.rpc.Code.RESOURCE_EXHAUSTED][google.rpc.Code.RESOURCE_EXHAUSTED]. - RESOURCE_EXHAUSTED = 8; - - // The consumer hasn't activated the service. - SERVICE_NOT_ACTIVATED = 104; - - // The consumer cannot access the service because billing is disabled. - BILLING_DISABLED = 107; - - // The consumer's project has been marked as deleted (soft deletion). - PROJECT_DELETED = 108; - - // The consumer's project number or id does not represent a valid project. - PROJECT_INVALID = 114; - - // The input consumer info does not represent a valid consumer folder or - // organization. - CONSUMER_INVALID = 125; - - // The IP address of the consumer is invalid for the specific consumer - // project. - IP_ADDRESS_BLOCKED = 109; - - // The referer address of the consumer request is invalid for the specific - // consumer project. - REFERER_BLOCKED = 110; - - // The client application of the consumer request is invalid for the - // specific consumer project. - CLIENT_APP_BLOCKED = 111; - - // The API targeted by this request is invalid for the specified consumer - // project. - API_TARGET_BLOCKED = 122; - - // The consumer's API key is invalid. - API_KEY_INVALID = 105; - - // The consumer's API Key has expired. - API_KEY_EXPIRED = 112; - - // The consumer's API Key was not found in config record. - API_KEY_NOT_FOUND = 113; - - // The credential in the request can not be verified. - INVALID_CREDENTIAL = 123; - - // The backend server for looking up project id/number is unavailable. - NAMESPACE_LOOKUP_UNAVAILABLE = 300; - - // The backend server for checking service status is unavailable. - SERVICE_STATUS_UNAVAILABLE = 301; - - // The backend server for checking billing status is unavailable. - BILLING_STATUS_UNAVAILABLE = 302; - - // Cloud Resource Manager backend server is unavailable. - CLOUD_RESOURCE_MANAGER_BACKEND_UNAVAILABLE = 305; - } - - // The error code. - Code code = 1; - - // Subject to whom this error applies. See the specific code enum for more - // details on this field. For example: - // - // - "project:" - // - "folder:" - // - "organization:" - string subject = 4; - - // Free-form text providing details on the error cause of the error. - string detail = 2; - - // Contains public information about the check error. If available, - // `status.code` will be non zero and client can propagate it out as public - // error. - google.rpc.Status status = 3; -} diff --git a/owl-bot-staging/v1/protos/google/api/servicecontrol/v1/distribution.proto b/owl-bot-staging/v1/protos/google/api/servicecontrol/v1/distribution.proto deleted file mode 100644 index e874e44..0000000 --- a/owl-bot-staging/v1/protos/google/api/servicecontrol/v1/distribution.proto +++ /dev/null @@ -1,166 +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 -// -// 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.api.servicecontrol.v1; - -import "google/api/distribution.proto"; - -option cc_enable_arenas = true; -option csharp_namespace = "Google.Cloud.ServiceControl.V1"; -option go_package = "google.golang.org/genproto/googleapis/api/servicecontrol/v1;servicecontrol"; -option java_multiple_files = true; -option java_outer_classname = "DistributionProto"; -option java_package = "com.google.api.servicecontrol.v1"; -option php_namespace = "Google\\Cloud\\ServiceControl\\V1"; -option ruby_package = "Google::Cloud::ServiceControl::V1"; - -// Distribution represents a frequency distribution of double-valued sample -// points. It contains the size of the population of sample points plus -// additional optional information: -// -// * the arithmetic mean of the samples -// * the minimum and maximum of the samples -// * the sum-squared-deviation of the samples, used to compute variance -// * a histogram of the values of the sample points -message Distribution { - // Describing buckets with constant width. - message LinearBuckets { - // The number of finite buckets. With the underflow and overflow buckets, - // the total number of buckets is `num_finite_buckets` + 2. - // See comments on `bucket_options` for details. - int32 num_finite_buckets = 1; - - // The i'th linear bucket covers the interval - // [offset + (i-1) * width, offset + i * width) - // where i ranges from 1 to num_finite_buckets, inclusive. - // Must be strictly positive. - double width = 2; - - // The i'th linear bucket covers the interval - // [offset + (i-1) * width, offset + i * width) - // where i ranges from 1 to num_finite_buckets, inclusive. - double offset = 3; - } - - // Describing buckets with exponentially growing width. - message ExponentialBuckets { - // The number of finite buckets. With the underflow and overflow buckets, - // the total number of buckets is `num_finite_buckets` + 2. - // See comments on `bucket_options` for details. - int32 num_finite_buckets = 1; - - // The i'th exponential bucket covers the interval - // [scale * growth_factor^(i-1), scale * growth_factor^i) - // where i ranges from 1 to num_finite_buckets inclusive. - // Must be larger than 1.0. - double growth_factor = 2; - - // The i'th exponential bucket covers the interval - // [scale * growth_factor^(i-1), scale * growth_factor^i) - // where i ranges from 1 to num_finite_buckets inclusive. - // Must be > 0. - double scale = 3; - } - - // Describing buckets with arbitrary user-provided width. - message ExplicitBuckets { - // 'bound' is a list of strictly increasing boundaries between - // buckets. Note that a list of length N-1 defines N buckets because - // of fenceposting. See comments on `bucket_options` for details. - // - // The i'th finite bucket covers the interval - // [bound[i-1], bound[i]) - // where i ranges from 1 to bound_size() - 1. Note that there are no - // finite buckets at all if 'bound' only contains a single element; in - // that special case the single bound defines the boundary between the - // underflow and overflow buckets. - // - // bucket number lower bound upper bound - // i == 0 (underflow) -inf bound[i] - // 0 < i < bound_size() bound[i-1] bound[i] - // i == bound_size() (overflow) bound[i-1] +inf - repeated double bounds = 1; - } - - // The total number of samples in the distribution. Must be >= 0. - int64 count = 1; - - // The arithmetic mean of the samples in the distribution. If `count` is - // zero then this field must be zero. - double mean = 2; - - // The minimum of the population of values. Ignored if `count` is zero. - double minimum = 3; - - // The maximum of the population of values. Ignored if `count` is zero. - double maximum = 4; - - // The sum of squared deviations from the mean: - // Sum[i=1..count]((x_i - mean)^2) - // where each x_i is a sample values. If `count` is zero then this field - // must be zero, otherwise validation of the request fails. - double sum_of_squared_deviation = 5; - - // The number of samples in each histogram bucket. `bucket_counts` are - // optional. If present, they must sum to the `count` value. - // - // The buckets are defined below in `bucket_option`. There are N buckets. - // `bucket_counts[0]` is the number of samples in the underflow bucket. - // `bucket_counts[1]` to `bucket_counts[N-1]` are the numbers of samples - // in each of the finite buckets. And `bucket_counts[N] is the number - // of samples in the overflow bucket. See the comments of `bucket_option` - // below for more details. - // - // Any suffix of trailing zeros may be omitted. - repeated int64 bucket_counts = 6; - - // Defines the buckets in the histogram. `bucket_option` and `bucket_counts` - // must be both set, or both unset. - // - // Buckets are numbered in the range of [0, N], with a total of N+1 buckets. - // There must be at least two buckets (a single-bucket histogram gives - // no information that isn't already provided by `count`). - // - // The first bucket is the underflow bucket which has a lower bound - // of -inf. The last bucket is the overflow bucket which has an - // upper bound of +inf. All other buckets (if any) are called "finite" - // buckets because they have finite lower and upper bounds. As described - // below, there are three ways to define the finite buckets. - // - // (1) Buckets with constant width. - // (2) Buckets with exponentially growing widths. - // (3) Buckets with arbitrary user-provided widths. - // - // In all cases, the buckets cover the entire real number line (-inf, - // +inf). Bucket upper bounds are exclusive and lower bounds are - // inclusive. The upper bound of the underflow bucket is equal to the - // lower bound of the smallest finite bucket; the lower bound of the - // overflow bucket is equal to the upper bound of the largest finite - // bucket. - oneof bucket_option { - // Buckets with constant width. - LinearBuckets linear_buckets = 7; - - // Buckets with exponentially growing width. - ExponentialBuckets exponential_buckets = 8; - - // Buckets with arbitrary user-provided width. - ExplicitBuckets explicit_buckets = 9; - } - - // Example points. Must be in increasing order of `value` field. - repeated google.api.Distribution.Exemplar exemplars = 10; -} diff --git a/owl-bot-staging/v1/protos/google/api/servicecontrol/v1/http_request.proto b/owl-bot-staging/v1/protos/google/api/servicecontrol/v1/http_request.proto deleted file mode 100644 index 1587203..0000000 --- a/owl-bot-staging/v1/protos/google/api/servicecontrol/v1/http_request.proto +++ /dev/null @@ -1,93 +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 -// -// 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.api.servicecontrol.v1; - -import "google/protobuf/duration.proto"; - -option csharp_namespace = "Google.Cloud.ServiceControl.V1"; -option go_package = "google.golang.org/genproto/googleapis/api/servicecontrol/v1;servicecontrol"; -option java_multiple_files = true; -option java_outer_classname = "HttpRequestProto"; -option java_package = "com.google.api.servicecontrol.v1"; -option php_namespace = "Google\\Cloud\\ServiceControl\\V1"; -option ruby_package = "Google::Cloud::ServiceControl::V1"; - -// A common proto for logging HTTP requests. Only contains semantics -// defined by the HTTP specification. Product-specific logging -// information MUST be defined in a separate message. -message HttpRequest { - // The request method. Examples: `"GET"`, `"HEAD"`, `"PUT"`, `"POST"`. - string request_method = 1; - - // The scheme (http, https), the host name, the path, and the query - // portion of the URL that was requested. - // Example: `"http://example.com/some/info?color=red"`. - string request_url = 2; - - // The size of the HTTP request message in bytes, including the request - // headers and the request body. - int64 request_size = 3; - - // The response code indicating the status of the response. - // Examples: 200, 404. - int32 status = 4; - - // The size of the HTTP response message sent back to the client, in bytes, - // including the response headers and the response body. - int64 response_size = 5; - - // The user agent sent by the client. Example: - // `"Mozilla/4.0 (compatible; MSIE 6.0; Windows 98; Q312461; .NET - // CLR 1.0.3705)"`. - string user_agent = 6; - - // The IP address (IPv4 or IPv6) of the client that issued the HTTP - // request. Examples: `"192.168.1.1"`, `"FE80::0202:B3FF:FE1E:8329"`. - string remote_ip = 7; - - // The IP address (IPv4 or IPv6) of the origin server that the request was - // sent to. - string server_ip = 13; - - // The referer URL of the request, as defined in - // [HTTP/1.1 Header Field - // Definitions](http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html). - string referer = 8; - - // The request processing latency on the server, from the time the request was - // received until the response was sent. - google.protobuf.Duration latency = 14; - - // Whether or not a cache lookup was attempted. - bool cache_lookup = 11; - - // Whether or not an entity was served from cache - // (with or without validation). - bool cache_hit = 9; - - // Whether or not the response was validated with the origin server before - // being served from cache. This field is only meaningful if `cache_hit` is - // True. - bool cache_validated_with_origin_server = 10; - - // The number of HTTP response bytes inserted into cache. Set only when a - // cache fill was attempted. - int64 cache_fill_bytes = 12; - - // Protocol used for the request. Examples: "HTTP/1.1", "HTTP/2", "websocket" - string protocol = 15; -} diff --git a/owl-bot-staging/v1/protos/google/api/servicecontrol/v1/log_entry.proto b/owl-bot-staging/v1/protos/google/api/servicecontrol/v1/log_entry.proto deleted file mode 100644 index 4f20aef..0000000 --- a/owl-bot-staging/v1/protos/google/api/servicecontrol/v1/log_entry.proto +++ /dev/null @@ -1,126 +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 -// -// 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.api.servicecontrol.v1; - -import "google/api/servicecontrol/v1/http_request.proto"; -import "google/logging/type/log_severity.proto"; -import "google/protobuf/any.proto"; -import "google/protobuf/struct.proto"; -import "google/protobuf/timestamp.proto"; - -option csharp_namespace = "Google.Cloud.ServiceControl.V1"; -option go_package = "google.golang.org/genproto/googleapis/api/servicecontrol/v1;servicecontrol"; -option java_multiple_files = true; -option java_outer_classname = "LogEntryProto"; -option java_package = "com.google.api.servicecontrol.v1"; -option php_namespace = "Google\\Cloud\\ServiceControl\\V1"; -option ruby_package = "Google::Cloud::ServiceControl::V1"; - -// An individual log entry. -message LogEntry { - // Required. The log to which this log entry belongs. Examples: `"syslog"`, - // `"book_log"`. - string name = 10; - - // The time the event described by the log entry occurred. If - // omitted, defaults to operation start time. - google.protobuf.Timestamp timestamp = 11; - - // The severity of the log entry. The default value is - // `LogSeverity.DEFAULT`. - google.logging.type.LogSeverity severity = 12; - - // Optional. Information about the HTTP request associated with this - // log entry, if applicable. - HttpRequest http_request = 14; - - // Optional. Resource name of the trace associated with the log entry, if any. - // If this field contains a relative resource name, you can assume the name is - // relative to `//tracing.googleapis.com`. Example: - // `projects/my-projectid/traces/06796866738c859f2f19b7cfb3214824` - string trace = 15; - - // A unique ID for the log entry used for deduplication. If omitted, - // the implementation will generate one based on operation_id. - string insert_id = 4; - - // A set of user-defined (key, value) data that provides additional - // information about the log entry. - map labels = 13; - - // The log entry payload, which can be one of multiple types. - oneof payload { - // The log entry payload, represented as a protocol buffer that is - // expressed as a JSON object. The only accepted type currently is - // [AuditLog][google.cloud.audit.AuditLog]. - google.protobuf.Any proto_payload = 2; - - // The log entry payload, represented as a Unicode string (UTF-8). - string text_payload = 3; - - // The log entry payload, represented as a structure that - // is expressed as a JSON object. - google.protobuf.Struct struct_payload = 6; - } - - // Optional. Information about an operation associated with the log entry, if - // applicable. - LogEntryOperation operation = 16; - - // Optional. Source code location information associated with the log entry, - // if any. - LogEntrySourceLocation source_location = 17; -} - -// Additional information about a potentially long-running operation with which -// a log entry is associated. -message LogEntryOperation { - // Optional. An arbitrary operation identifier. Log entries with the - // same identifier are assumed to be part of the same operation. - string id = 1; - - // Optional. An arbitrary producer identifier. The combination of - // `id` and `producer` must be globally unique. Examples for `producer`: - // `"MyDivision.MyBigCompany.com"`, `"github.com/MyProject/MyApplication"`. - string producer = 2; - - // Optional. Set this to True if this is the first log entry in the operation. - bool first = 3; - - // Optional. Set this to True if this is the last log entry in the operation. - bool last = 4; -} - -// Additional information about the source code location that produced the log -// entry. -message LogEntrySourceLocation { - // Optional. Source file name. Depending on the runtime environment, this - // might be a simple name or a fully-qualified name. - string file = 1; - - // Optional. Line within the source file. 1-based; 0 indicates no line number - // available. - int64 line = 2; - - // Optional. Human-readable name of the function or method being invoked, with - // optional context such as the class or package name. This information may be - // used in contexts such as the logs viewer, where a file and line number are - // less meaningful. The format can vary by language. For example: - // `qual.if.ied.Class.method` (Java), `dir/package.func` (Go), `function` - // (Python). - string function = 3; -} diff --git a/owl-bot-staging/v1/protos/google/api/servicecontrol/v1/metric_value.proto b/owl-bot-staging/v1/protos/google/api/servicecontrol/v1/metric_value.proto deleted file mode 100644 index c0e2a42..0000000 --- a/owl-bot-staging/v1/protos/google/api/servicecontrol/v1/metric_value.proto +++ /dev/null @@ -1,81 +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 -// -// 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.api.servicecontrol.v1; - -import "google/api/servicecontrol/v1/distribution.proto"; -import "google/protobuf/timestamp.proto"; - -option cc_enable_arenas = true; -option csharp_namespace = "Google.Cloud.ServiceControl.V1"; -option go_package = "google.golang.org/genproto/googleapis/api/servicecontrol/v1;servicecontrol"; -option java_multiple_files = true; -option java_outer_classname = "MetricValueSetProto"; -option java_package = "com.google.api.servicecontrol.v1"; -option php_namespace = "Google\\Cloud\\ServiceControl\\V1"; -option ruby_package = "Google::Cloud::ServiceControl::V1"; - -// Represents a single metric value. -message MetricValue { - // The labels describing the metric value. - // See comments on [google.api.servicecontrol.v1.Operation.labels][google.api.servicecontrol.v1.Operation.labels] for - // the overriding relationship. - // Note that this map must not contain monitored resource labels. - map labels = 1; - - // The start of the time period over which this metric value's measurement - // applies. The time period has different semantics for different metric - // types (cumulative, delta, and gauge). See the metric definition - // documentation in the service configuration for details. If not specified, - // [google.api.servicecontrol.v1.Operation.start_time][google.api.servicecontrol.v1.Operation.start_time] will be used. - google.protobuf.Timestamp start_time = 2; - - // The end of the time period over which this metric value's measurement - // applies. If not specified, - // [google.api.servicecontrol.v1.Operation.end_time][google.api.servicecontrol.v1.Operation.end_time] will be used. - google.protobuf.Timestamp end_time = 3; - - // The value. The type of value used in the request must - // agree with the metric definition in the service configuration, otherwise - // the MetricValue is rejected. - oneof value { - // A boolean value. - bool bool_value = 4; - - // A signed 64-bit integer value. - int64 int64_value = 5; - - // A double precision floating point value. - double double_value = 6; - - // A text string value. - string string_value = 7; - - // A distribution value. - Distribution distribution_value = 8; - } -} - -// Represents a set of metric values in the same metric. -// Each metric value in the set should have a unique combination of start time, -// end time, and label values. -message MetricValueSet { - // The metric name defined in the service configuration. - string metric_name = 1; - - // The values in this metric. - repeated MetricValue metric_values = 2; -} diff --git a/owl-bot-staging/v1/protos/google/api/servicecontrol/v1/operation.proto b/owl-bot-staging/v1/protos/google/api/servicecontrol/v1/operation.proto deleted file mode 100644 index 7ce6cd4..0000000 --- a/owl-bot-staging/v1/protos/google/api/servicecontrol/v1/operation.proto +++ /dev/null @@ -1,123 +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 -// -// 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.api.servicecontrol.v1; - -import "google/api/servicecontrol/v1/log_entry.proto"; -import "google/api/servicecontrol/v1/metric_value.proto"; -import "google/protobuf/any.proto"; -import "google/protobuf/timestamp.proto"; - -option cc_enable_arenas = true; -option csharp_namespace = "Google.Cloud.ServiceControl.V1"; -option go_package = "google.golang.org/genproto/googleapis/api/servicecontrol/v1;servicecontrol"; -option java_multiple_files = true; -option java_outer_classname = "OperationProto"; -option java_package = "com.google.api.servicecontrol.v1"; -option php_namespace = "Google\\Cloud\\ServiceControl\\V1"; -option ruby_package = "Google::Cloud::ServiceControl::V1"; - -// Represents information regarding an operation. -message Operation { - // Defines the importance of the data contained in the operation. - enum Importance { - // Allows data caching, batching, and aggregation. It provides - // higher performance with higher data loss risk. - LOW = 0; - - // Disables data aggregation to minimize data loss. It is for operations - // that contains significant monetary value or audit trail. This feature - // only applies to the client libraries. - HIGH = 1; - } - - // Identity of the operation. This must be unique within the scope of the - // service that generated the operation. If the service calls - // Check() and Report() on the same operation, the two calls should carry - // the same id. - // - // UUID version 4 is recommended, though not required. - // In scenarios where an operation is computed from existing information - // and an idempotent id is desirable for deduplication purpose, UUID version 5 - // is recommended. See RFC 4122 for details. - string operation_id = 1; - - // Fully qualified name of the operation. Reserved for future use. - string operation_name = 2; - - // Identity of the consumer who is using the service. - // This field should be filled in for the operations initiated by a - // consumer, but not for service-initiated operations that are - // not related to a specific consumer. - // - // - This can be in one of the following formats: - // - project:PROJECT_ID, - // - project`_`number:PROJECT_NUMBER, - // - projects/PROJECT_ID or PROJECT_NUMBER, - // - folders/FOLDER_NUMBER, - // - organizations/ORGANIZATION_NUMBER, - // - api`_`key:API_KEY. - string consumer_id = 3; - - // Required. Start time of the operation. - google.protobuf.Timestamp start_time = 4; - - // End time of the operation. - // Required when the operation is used in - // [ServiceController.Report][google.api.servicecontrol.v1.ServiceController.Report], - // but optional when the operation is used in - // [ServiceController.Check][google.api.servicecontrol.v1.ServiceController.Check]. - google.protobuf.Timestamp end_time = 5; - - // Labels describing the operation. Only the following labels are allowed: - // - // - Labels describing monitored resources as defined in - // the service configuration. - // - Default labels of metric values. When specified, labels defined in the - // metric value override these default. - // - The following labels defined by Google Cloud Platform: - // - `cloud.googleapis.com/location` describing the location where the - // operation happened, - // - `servicecontrol.googleapis.com/user_agent` describing the user agent - // of the API request, - // - `servicecontrol.googleapis.com/service_agent` describing the service - // used to handle the API request (e.g. ESP), - // - `servicecontrol.googleapis.com/platform` describing the platform - // where the API is served, such as App Engine, Compute Engine, or - // Kubernetes Engine. - map labels = 6; - - // Represents information about this operation. Each MetricValueSet - // corresponds to a metric defined in the service configuration. - // The data type used in the MetricValueSet must agree with - // the data type specified in the metric definition. - // - // Within a single operation, it is not allowed to have more than one - // MetricValue instances that have the same metric names and identical - // label value combinations. If a request has such duplicated MetricValue - // instances, the entire request is rejected with - // an invalid argument error. - repeated MetricValueSet metric_value_sets = 7; - - // Represents information to be logged. - repeated LogEntry log_entries = 8; - - // DO NOT USE. This is an experimental field. - Importance importance = 11; - - // Unimplemented. - repeated google.protobuf.Any extensions = 16; -} diff --git a/owl-bot-staging/v1/protos/google/api/servicecontrol/v1/quota_controller.proto b/owl-bot-staging/v1/protos/google/api/servicecontrol/v1/quota_controller.proto deleted file mode 100644 index 58b13ee..0000000 --- a/owl-bot-staging/v1/protos/google/api/servicecontrol/v1/quota_controller.proto +++ /dev/null @@ -1,245 +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 -// -// 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.api.servicecontrol.v1; - -import "google/api/annotations.proto"; -import "google/api/servicecontrol/v1/metric_value.proto"; -import "google/rpc/status.proto"; -import "google/api/client.proto"; - -option cc_enable_arenas = true; -option csharp_namespace = "Google.Cloud.ServiceControl.V1"; -option go_package = "google.golang.org/genproto/googleapis/api/servicecontrol/v1;servicecontrol"; -option java_multiple_files = true; -option java_outer_classname = "QuotaControllerProto"; -option java_package = "com.google.api.servicecontrol.v1"; -option php_namespace = "Google\\Cloud\\ServiceControl\\V1"; -option ruby_package = "Google::Cloud::ServiceControl::V1"; - -// [Google Quota Control API](/service-control/overview) -// -// Allows clients to allocate and release quota against a [managed -// service](https://cloud.google.com/service-management/reference/rpc/google.api/servicemanagement.v1#google.api.servicemanagement.v1.ManagedService). -service QuotaController { - option (google.api.default_host) = "servicecontrol.googleapis.com"; - option (google.api.oauth_scopes) = - "https://www.googleapis.com/auth/cloud-platform," - "https://www.googleapis.com/auth/servicecontrol"; - - // Attempts to allocate quota for the specified consumer. It should be called - // before the operation is executed. - // - // This method requires the `servicemanagement.services.quota` - // permission on the specified service. For more information, see - // [Cloud IAM](https://cloud.google.com/iam). - // - // **NOTE:** The client **must** fail-open on server errors `INTERNAL`, - // `UNKNOWN`, `DEADLINE_EXCEEDED`, and `UNAVAILABLE`. To ensure system - // reliability, the server may inject these errors to prohibit any hard - // dependency on the quota functionality. - rpc AllocateQuota(AllocateQuotaRequest) returns (AllocateQuotaResponse) { - option (google.api.http) = { - post: "/v1/services/{service_name}:allocateQuota" - body: "*" - }; - } -} - -// Request message for the AllocateQuota method. -message AllocateQuotaRequest { - // Name of the service as specified in the service configuration. For example, - // `"pubsub.googleapis.com"`. - // - // See [google.api.Service][google.api.Service] for the definition of a service name. - string service_name = 1; - - // Operation that describes the quota allocation. - QuotaOperation allocate_operation = 2; - - // Specifies which version of service configuration should be used to process - // the request. If unspecified or no matching version can be found, the latest - // one will be used. - string service_config_id = 4; -} - -// Represents information regarding a quota operation. -message QuotaOperation { - // Supported quota modes. - enum QuotaMode { - // Guard against implicit default. Must not be used. - UNSPECIFIED = 0; - - // For AllocateQuota request, allocates quota for the amount specified in - // the service configuration or specified using the quota metrics. If the - // amount is higher than the available quota, allocation error will be - // returned and no quota will be allocated. - // If multiple quotas are part of the request, and one fails, none of the - // quotas are allocated or released. - NORMAL = 1; - - // The operation allocates quota for the amount specified in the service - // configuration or specified using the quota metrics. If the amount is - // higher than the available quota, request does not fail but all available - // quota will be allocated. - // For rate quota, BEST_EFFORT will continue to deduct from other groups - // even if one does not have enough quota. For allocation, it will find the - // minimum available amount across all groups and deduct that amount from - // all the affected groups. - BEST_EFFORT = 2; - - // For AllocateQuota request, only checks if there is enough quota - // available and does not change the available quota. No lock is placed on - // the available quota either. - CHECK_ONLY = 3; - - // Unimplemented. When used in AllocateQuotaRequest, this returns the - // effective quota limit(s) in the response, and no quota check will be - // performed. Not supported for other requests, and even for - // AllocateQuotaRequest, this is currently supported only for allowlisted - // services. - QUERY_ONLY = 4; - - // The operation allocates quota for the amount specified in the service - // configuration or specified using the quota metrics. If the requested - // amount is higher than the available quota, request does not fail and - // remaining quota would become negative (going over the limit). - // Not supported for Rate Quota. - ADJUST_ONLY = 5; - } - - // Identity of the operation. This is expected to be unique within the scope - // of the service that generated the operation, and guarantees idempotency in - // case of retries. - // - // In order to ensure best performance and latency in the Quota backends, - // operation_ids are optimally associated with time, so that related - // operations can be accessed fast in storage. For this reason, the - // recommended token for services that intend to operate at a high QPS is - // Unix time in nanos + UUID - string operation_id = 1; - - // Fully qualified name of the API method for which this quota operation is - // requested. This name is used for matching quota rules or metric rules and - // billing status rules defined in service configuration. - // - // This field should not be set if any of the following is true: - // (1) the quota operation is performed on non-API resources. - // (2) quota_metrics is set because the caller is doing quota override. - // - // - // Example of an RPC method name: - // google.example.library.v1.LibraryService.CreateShelf - string method_name = 2; - - // Identity of the consumer for whom this quota operation is being performed. - // - // This can be in one of the following formats: - // project:, - // project_number:, - // api_key:. - string consumer_id = 3; - - // Labels describing the operation. - map labels = 4; - - // Represents information about this operation. Each MetricValueSet - // corresponds to a metric defined in the service configuration. - // The data type used in the MetricValueSet must agree with - // the data type specified in the metric definition. - // - // Within a single operation, it is not allowed to have more than one - // MetricValue instances that have the same metric names and identical - // label value combinations. If a request has such duplicated MetricValue - // instances, the entire request is rejected with - // an invalid argument error. - // - // This field is mutually exclusive with method_name. - repeated MetricValueSet quota_metrics = 5; - - // Quota mode for this operation. - QuotaMode quota_mode = 6; -} - -// Response message for the AllocateQuota method. -message AllocateQuotaResponse { - // The same operation_id value used in the AllocateQuotaRequest. Used for - // logging and diagnostics purposes. - string operation_id = 1; - - // Indicates the decision of the allocate. - repeated QuotaError allocate_errors = 2; - - // Quota metrics to indicate the result of allocation. Depending on the - // request, one or more of the following metrics will be included: - // - // 1. Per quota group or per quota metric incremental usage will be specified - // using the following delta metric : - // "serviceruntime.googleapis.com/api/consumer/quota_used_count" - // - // 2. The quota limit reached condition will be specified using the following - // boolean metric : - // "serviceruntime.googleapis.com/quota/exceeded" - repeated MetricValueSet quota_metrics = 3; - - // ID of the actual config used to process the request. - string service_config_id = 4; -} - -// Represents error information for [QuotaOperation][google.api.servicecontrol.v1.QuotaOperation]. -message QuotaError { - // Error codes related to project config validations are deprecated since the - // quota controller methods do not perform these validations. Instead services - // have to call the Check method, without quota_properties field, to perform - // these validations before calling the quota controller methods. These - // methods check only for project deletion to be wipe out compliant. - enum Code { - // This is never used. - UNSPECIFIED = 0; - - // Quota allocation failed. - // Same as [google.rpc.Code.RESOURCE_EXHAUSTED][google.rpc.Code.RESOURCE_EXHAUSTED]. - RESOURCE_EXHAUSTED = 8; - - // Consumer cannot access the service because the service requires active - // billing. - BILLING_NOT_ACTIVE = 107; - - // Consumer's project has been marked as deleted (soft deletion). - PROJECT_DELETED = 108; - - // Specified API key is invalid. - API_KEY_INVALID = 105; - - // Specified API Key has expired. - API_KEY_EXPIRED = 112; - } - - // Error code. - Code code = 1; - - // Subject to whom this error applies. See the specific enum for more details - // on this field. For example, "clientip:" or - // "project:". - string subject = 2; - - // Free-form text that provides details on the cause of the error. - string description = 3; - - // Contains additional information about the quota error. - // If available, `status.code` will be non zero. - google.rpc.Status status = 4; -} diff --git a/owl-bot-staging/v1/protos/google/api/servicecontrol/v1/service_controller.proto b/owl-bot-staging/v1/protos/google/api/servicecontrol/v1/service_controller.proto deleted file mode 100644 index 8580fc7..0000000 --- a/owl-bot-staging/v1/protos/google/api/servicecontrol/v1/service_controller.proto +++ /dev/null @@ -1,256 +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 -// -// 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.api.servicecontrol.v1; - -import "google/api/annotations.proto"; -import "google/api/client.proto"; -import "google/api/servicecontrol/v1/check_error.proto"; -import "google/api/servicecontrol/v1/operation.proto"; -import "google/protobuf/timestamp.proto"; -import "google/rpc/status.proto"; - -option cc_enable_arenas = true; -option csharp_namespace = "Google.Cloud.ServiceControl.V1"; -option go_package = "google.golang.org/genproto/googleapis/api/servicecontrol/v1;servicecontrol"; -option java_multiple_files = true; -option java_outer_classname = "ServiceControllerProto"; -option java_package = "com.google.api.servicecontrol.v1"; -option objc_class_prefix = "GASC"; -option php_namespace = "Google\\Cloud\\ServiceControl\\V1"; -option ruby_package = "Google::Cloud::ServiceControl::V1"; - -// [Google Service Control API](/service-control/overview) -// -// Lets clients check and report operations against a [managed -// service](https://cloud.google.com/service-management/reference/rpc/google.api/servicemanagement.v1#google.api.servicemanagement.v1.ManagedService). -service ServiceController { - option (google.api.default_host) = "servicecontrol.googleapis.com"; - option (google.api.oauth_scopes) = - "https://www.googleapis.com/auth/cloud-platform," - "https://www.googleapis.com/auth/servicecontrol"; - - // Checks whether an operation on a service should be allowed to proceed - // based on the configuration of the service and related policies. It must be - // called before the operation is executed. - // - // If feasible, the client should cache the check results and reuse them for - // 60 seconds. In case of any server errors, the client should rely on the - // cached results for much longer time to avoid outage. - // WARNING: There is general 60s delay for the configuration and policy - // propagation, therefore callers MUST NOT depend on the `Check` method having - // the latest policy information. - // - // NOTE: the [CheckRequest][google.api.servicecontrol.v1.CheckRequest] has - // the size limit (wire-format byte size) of 1MB. - // - // This method requires the `servicemanagement.services.check` permission - // on the specified service. For more information, see - // [Cloud IAM](https://cloud.google.com/iam). - rpc Check(CheckRequest) returns (CheckResponse) { - option (google.api.http) = { - post: "/v1/services/{service_name}:check" - body: "*" - }; - } - - // Reports operation results to Google Service Control, such as logs and - // metrics. It should be called after an operation is completed. - // - // If feasible, the client should aggregate reporting data for up to 5 - // seconds to reduce API traffic. Limiting aggregation to 5 seconds is to - // reduce data loss during client crashes. Clients should carefully choose - // the aggregation time window to avoid data loss risk more than 0.01% - // for business and compliance reasons. - // - // NOTE: the [ReportRequest][google.api.servicecontrol.v1.ReportRequest] has - // the size limit (wire-format byte size) of 1MB. - // - // This method requires the `servicemanagement.services.report` permission - // on the specified service. For more information, see - // [Google Cloud IAM](https://cloud.google.com/iam). - rpc Report(ReportRequest) returns (ReportResponse) { - option (google.api.http) = { - post: "/v1/services/{service_name}:report" - body: "*" - }; - } -} - -// Request message for the Check method. -message CheckRequest { - // The service name as specified in its service configuration. For example, - // `"pubsub.googleapis.com"`. - // - // See - // [google.api.Service](https://cloud.google.com/service-management/reference/rpc/google.api#google.api.Service) - // for the definition of a service name. - string service_name = 1; - - // The operation to be checked. - Operation operation = 2; - - // Specifies which version of service configuration should be used to process - // the request. - // - // If unspecified or no matching version can be found, the - // latest one will be used. - string service_config_id = 4; -} - -// Response message for the Check method. -message CheckResponse { - // Contains additional information about the check operation. - message CheckInfo { - // A list of fields and label keys that are ignored by the server. - // The client doesn't need to send them for following requests to improve - // performance and allow better aggregation. - repeated string unused_arguments = 1; - - // Consumer info of this check. - ConsumerInfo consumer_info = 2; - } - - // `ConsumerInfo` provides information about the consumer. - message ConsumerInfo { - // The type of the consumer as defined in - // [Google Resource Manager](https://cloud.google.com/resource-manager/). - enum ConsumerType { - // This is never used. - CONSUMER_TYPE_UNSPECIFIED = 0; - - // The consumer is a Google Cloud Project. - PROJECT = 1; - - // The consumer is a Google Cloud Folder. - FOLDER = 2; - - // The consumer is a Google Cloud Organization. - ORGANIZATION = 3; - - // Service-specific resource container which is defined by the service - // producer to offer their users the ability to manage service control - // functionalities at a finer level of granularity than the PROJECT. - SERVICE_SPECIFIC = 4; - } - - // The Google cloud project number, e.g. 1234567890. A value of 0 indicates - // no project number is found. - // - // NOTE: This field is deprecated after we support flexible consumer - // id. New code should not depend on this field anymore. - int64 project_number = 1; - - // The type of the consumer which should have been defined in - // [Google Resource Manager](https://cloud.google.com/resource-manager/). - ConsumerType type = 2; - - // The consumer identity number, can be Google cloud project number, folder - // number or organization number e.g. 1234567890. A value of 0 indicates no - // consumer number is found. - int64 consumer_number = 3; - } - - // The same operation_id value used in the - // [CheckRequest][google.api.servicecontrol.v1.CheckRequest]. Used for logging - // and diagnostics purposes. - string operation_id = 1; - - // Indicate the decision of the check. - // - // If no check errors are present, the service should process the operation. - // Otherwise the service should use the list of errors to determine the - // appropriate action. - repeated CheckError check_errors = 2; - - // The actual config id used to process the request. - string service_config_id = 5; - - // The current service rollout id used to process the request. - string service_rollout_id = 11; - - // Feedback data returned from the server during processing a Check request. - CheckInfo check_info = 6; -} - -// Request message for the Report method. -message ReportRequest { - // The service name as specified in its service configuration. For example, - // `"pubsub.googleapis.com"`. - // - // See - // [google.api.Service](https://cloud.google.com/service-management/reference/rpc/google.api#google.api.Service) - // for the definition of a service name. - string service_name = 1; - - // Operations to be reported. - // - // Typically the service should report one operation per request. - // Putting multiple operations into a single request is allowed, but should - // be used only when multiple operations are natually available at the time - // of the report. - // - // There is no limit on the number of operations in the same ReportRequest, - // however the ReportRequest size should be no larger than 1MB. See - // [ReportResponse.report_errors][google.api.servicecontrol.v1.ReportResponse.report_errors] - // for partial failure behavior. - repeated Operation operations = 2; - - // Specifies which version of service config should be used to process the - // request. - // - // If unspecified or no matching version can be found, the - // latest one will be used. - string service_config_id = 3; -} - -// Response message for the Report method. -message ReportResponse { - // Represents the processing error of one - // [Operation][google.api.servicecontrol.v1.Operation] in the request. - message ReportError { - // The - // [Operation.operation_id][google.api.servicecontrol.v1.Operation.operation_id] - // value from the request. - string operation_id = 1; - - // Details of the error when processing the - // [Operation][google.api.servicecontrol.v1.Operation]. - google.rpc.Status status = 2; - } - - // Partial failures, one for each `Operation` in the request that failed - // processing. There are three possible combinations of the RPC status: - // - // 1. The combination of a successful RPC status and an empty `report_errors` - // list indicates a complete success where all `Operations` in the - // request are processed successfully. - // 2. The combination of a successful RPC status and a non-empty - // `report_errors` list indicates a partial success where some - // `Operations` in the request succeeded. Each - // `Operation` that failed processing has a corresponding item - // in this list. - // 3. A failed RPC status indicates a general non-deterministic failure. - // When this happens, it's impossible to know which of the - // 'Operations' in the request succeeded or failed. - repeated ReportError report_errors = 1; - - // The actual config id used to process the request. - string service_config_id = 2; - - // The current service rollout id used to process the request. - string service_rollout_id = 4; -} diff --git a/owl-bot-staging/v1/protos/google/logging/type/http_request.proto b/owl-bot-staging/v1/protos/google/logging/type/http_request.proto deleted file mode 100644 index b878d60..0000000 --- a/owl-bot-staging/v1/protos/google/logging/type/http_request.proto +++ /dev/null @@ -1,95 +0,0 @@ -// Copyright 2022 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.logging.type; - -import "google/protobuf/duration.proto"; - -option csharp_namespace = "Google.Cloud.Logging.Type"; -option go_package = "google.golang.org/genproto/googleapis/logging/type;ltype"; -option java_multiple_files = true; -option java_outer_classname = "HttpRequestProto"; -option java_package = "com.google.logging.type"; -option php_namespace = "Google\\Cloud\\Logging\\Type"; -option ruby_package = "Google::Cloud::Logging::Type"; - -// A common proto for logging HTTP requests. Only contains semantics -// defined by the HTTP specification. Product-specific logging -// information MUST be defined in a separate message. -message HttpRequest { - // The request method. Examples: `"GET"`, `"HEAD"`, `"PUT"`, `"POST"`. - string request_method = 1; - - // The scheme (http, https), the host name, the path and the query - // portion of the URL that was requested. - // Example: `"http://example.com/some/info?color=red"`. - string request_url = 2; - - // The size of the HTTP request message in bytes, including the request - // headers and the request body. - int64 request_size = 3; - - // The response code indicating the status of response. - // Examples: 200, 404. - int32 status = 4; - - // The size of the HTTP response message sent back to the client, in bytes, - // including the response headers and the response body. - int64 response_size = 5; - - // The user agent sent by the client. Example: - // `"Mozilla/4.0 (compatible; MSIE 6.0; Windows 98; Q312461; .NET - // CLR 1.0.3705)"`. - string user_agent = 6; - - // The IP address (IPv4 or IPv6) of the client that issued the HTTP - // request. This field can include port information. Examples: - // `"192.168.1.1"`, `"10.0.0.1:80"`, `"FE80::0202:B3FF:FE1E:8329"`. - string remote_ip = 7; - - // The IP address (IPv4 or IPv6) of the origin server that the request was - // sent to. This field can include port information. Examples: - // `"192.168.1.1"`, `"10.0.0.1:80"`, `"FE80::0202:B3FF:FE1E:8329"`. - string server_ip = 13; - - // The referer URL of the request, as defined in - // [HTTP/1.1 Header Field - // Definitions](http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html). - string referer = 8; - - // The request processing latency on the server, from the time the request was - // received until the response was sent. - google.protobuf.Duration latency = 14; - - // Whether or not a cache lookup was attempted. - bool cache_lookup = 11; - - // Whether or not an entity was served from cache - // (with or without validation). - bool cache_hit = 9; - - // Whether or not the response was validated with the origin server before - // being served from cache. This field is only meaningful if `cache_hit` is - // True. - bool cache_validated_with_origin_server = 10; - - // The number of HTTP response bytes inserted into cache. Set only when a - // cache fill was attempted. - int64 cache_fill_bytes = 12; - - // Protocol used for the request. Examples: "HTTP/1.1", "HTTP/2", "websocket" - string protocol = 15; -} diff --git a/owl-bot-staging/v1/protos/google/logging/type/log_severity.proto b/owl-bot-staging/v1/protos/google/logging/type/log_severity.proto deleted file mode 100644 index bed7193..0000000 --- a/owl-bot-staging/v1/protos/google/logging/type/log_severity.proto +++ /dev/null @@ -1,71 +0,0 @@ -// Copyright 2022 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.logging.type; - -option csharp_namespace = "Google.Cloud.Logging.Type"; -option go_package = "google.golang.org/genproto/googleapis/logging/type;ltype"; -option java_multiple_files = true; -option java_outer_classname = "LogSeverityProto"; -option java_package = "com.google.logging.type"; -option objc_class_prefix = "GLOG"; -option php_namespace = "Google\\Cloud\\Logging\\Type"; -option ruby_package = "Google::Cloud::Logging::Type"; - -// The severity of the event described in a log entry, expressed as one of the -// standard severity levels listed below. For your reference, the levels are -// assigned the listed numeric values. The effect of using numeric values other -// than those listed is undefined. -// -// You can filter for log entries by severity. For example, the following -// filter expression will match log entries with severities `INFO`, `NOTICE`, -// and `WARNING`: -// -// severity > DEBUG AND severity <= WARNING -// -// If you are writing log entries, you should map other severity encodings to -// one of these standard levels. For example, you might map all of Java's FINE, -// FINER, and FINEST levels to `LogSeverity.DEBUG`. You can preserve the -// original severity level in the log entry payload if you wish. -enum LogSeverity { - // (0) The log entry has no assigned severity level. - DEFAULT = 0; - - // (100) Debug or trace information. - DEBUG = 100; - - // (200) Routine information, such as ongoing status or performance. - INFO = 200; - - // (300) Normal but significant events, such as start up, shut down, or - // a configuration change. - NOTICE = 300; - - // (400) Warning events might cause problems. - WARNING = 400; - - // (500) Error events are likely to cause problems. - ERROR = 500; - - // (600) Critical events cause more severe problems or outages. - CRITICAL = 600; - - // (700) A person must take an action immediately. - ALERT = 700; - - // (800) One or more systems are unusable. - EMERGENCY = 800; -} diff --git a/owl-bot-staging/v1/samples/generated/v1/quota_controller.allocate_quota.js b/owl-bot-staging/v1/samples/generated/v1/quota_controller.allocate_quota.js deleted file mode 100644 index 554e011..0000000 --- a/owl-bot-staging/v1/samples/generated/v1/quota_controller.allocate_quota.js +++ /dev/null @@ -1,69 +0,0 @@ -// Copyright 2022 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 servicecontrol_v1_generated_QuotaController_AllocateQuota_async] - /** - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Name of the service as specified in the service configuration. For example, - * `"pubsub.googleapis.com"`. - * See google.api.Service google.api.Service for the definition of a service name. - */ - // const serviceName = 'abc123' - /** - * Operation that describes the quota allocation. - */ - // const allocateOperation = {} - /** - * Specifies which version of service configuration should be used to process - * the request. If unspecified or no matching version can be found, the latest - * one will be used. - */ - // const serviceConfigId = 'abc123' - - // Imports the Servicecontrol library - const {QuotaControllerClient} = require('@google-cloud/service-control').v1; - - // Instantiates a client - const servicecontrolClient = new QuotaControllerClient(); - - async function callAllocateQuota() { - // Construct request - const request = { - }; - - // Run request - const response = await servicecontrolClient.allocateQuota(request); - console.log(response); - } - - callAllocateQuota(); - // [END servicecontrol_v1_generated_QuotaController_AllocateQuota_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/v1/samples/generated/v1/service_controller.check.js b/owl-bot-staging/v1/samples/generated/v1/service_controller.check.js deleted file mode 100644 index 84c1b36..0000000 --- a/owl-bot-staging/v1/samples/generated/v1/service_controller.check.js +++ /dev/null @@ -1,72 +0,0 @@ -// Copyright 2022 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 servicecontrol_v1_generated_ServiceController_Check_async] - /** - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * The service name as specified in its service configuration. For example, - * `"pubsub.googleapis.com"`. - * See - * google.api.Service (https://cloud.google.com/service-management/reference/rpc/google.api#google.api.Service) - * for the definition of a service name. - */ - // const serviceName = 'abc123' - /** - * The operation to be checked. - */ - // const operation = {} - /** - * Specifies which version of service configuration should be used to process - * the request. - * If unspecified or no matching version can be found, the - * latest one will be used. - */ - // const serviceConfigId = 'abc123' - - // Imports the Servicecontrol library - const {ServiceControllerClient} = require('@google-cloud/service-control').v1; - - // Instantiates a client - const servicecontrolClient = new ServiceControllerClient(); - - async function callCheck() { - // Construct request - const request = { - }; - - // Run request - const response = await servicecontrolClient.check(request); - console.log(response); - } - - callCheck(); - // [END servicecontrol_v1_generated_ServiceController_Check_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/v1/samples/generated/v1/service_controller.report.js b/owl-bot-staging/v1/samples/generated/v1/service_controller.report.js deleted file mode 100644 index 40ce695..0000000 --- a/owl-bot-staging/v1/samples/generated/v1/service_controller.report.js +++ /dev/null @@ -1,80 +0,0 @@ -// Copyright 2022 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 servicecontrol_v1_generated_ServiceController_Report_async] - /** - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * The service name as specified in its service configuration. For example, - * `"pubsub.googleapis.com"`. - * See - * google.api.Service (https://cloud.google.com/service-management/reference/rpc/google.api#google.api.Service) - * for the definition of a service name. - */ - // const serviceName = 'abc123' - /** - * Operations to be reported. - * Typically the service should report one operation per request. - * Putting multiple operations into a single request is allowed, but should - * be used only when multiple operations are natually available at the time - * of the report. - * There is no limit on the number of operations in the same ReportRequest, - * however the ReportRequest size should be no larger than 1MB. See - * ReportResponse.report_errors google.api.servicecontrol.v1.ReportResponse.report_errors - * for partial failure behavior. - */ - // const operations = 1234 - /** - * Specifies which version of service config should be used to process the - * request. - * If unspecified or no matching version can be found, the - * latest one will be used. - */ - // const serviceConfigId = 'abc123' - - // Imports the Servicecontrol library - const {ServiceControllerClient} = require('@google-cloud/service-control').v1; - - // Instantiates a client - const servicecontrolClient = new ServiceControllerClient(); - - async function callReport() { - // Construct request - const request = { - }; - - // Run request - const response = await servicecontrolClient.report(request); - console.log(response); - } - - callReport(); - // [END servicecontrol_v1_generated_ServiceController_Report_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/v1/samples/generated/v1/snippet_metadata.google.api.servicecontrol.v1.json b/owl-bot-staging/v1/samples/generated/v1/snippet_metadata.google.api.servicecontrol.v1.json deleted file mode 100644 index 8b1d261..0000000 --- a/owl-bot-staging/v1/samples/generated/v1/snippet_metadata.google.api.servicecontrol.v1.json +++ /dev/null @@ -1,159 +0,0 @@ -{ - "clientLibrary": { - "name": "nodejs-servicecontrol", - "version": "0.1.0", - "language": "TYPESCRIPT", - "apis": [ - { - "id": "google.api.servicecontrol.v1", - "version": "v1" - } - ] - }, - "snippets": [ - { - "regionTag": "servicecontrol_v1_generated_QuotaController_AllocateQuota_async", - "title": "QuotaController allocateQuota Sample", - "origin": "API_DEFINITION", - "description": " Attempts to allocate quota for the specified consumer. It should be called before the operation is executed. This method requires the `servicemanagement.services.quota` permission on the specified service. For more information, see [Cloud IAM](https://cloud.google.com/iam). **NOTE:** The client **must** fail-open on server errors `INTERNAL`, `UNKNOWN`, `DEADLINE_EXCEEDED`, and `UNAVAILABLE`. To ensure system reliability, the server may inject these errors to prohibit any hard dependency on the quota functionality.", - "canonical": true, - "file": "quota_controller.allocate_quota.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 61, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "AllocateQuota", - "fullName": "google.api.servicecontrol.v1.QuotaController.AllocateQuota", - "async": true, - "parameters": [ - { - "name": "service_name", - "type": "TYPE_STRING" - }, - { - "name": "allocate_operation", - "type": ".google.api.servicecontrol.v1.QuotaOperation" - }, - { - "name": "service_config_id", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.api.servicecontrol.v1.AllocateQuotaResponse", - "client": { - "shortName": "QuotaControllerClient", - "fullName": "google.api.servicecontrol.v1.QuotaControllerClient" - }, - "method": { - "shortName": "AllocateQuota", - "fullName": "google.api.servicecontrol.v1.QuotaController.AllocateQuota", - "service": { - "shortName": "QuotaController", - "fullName": "google.api.servicecontrol.v1.QuotaController" - } - } - } - }, - { - "regionTag": "servicecontrol_v1_generated_ServiceController_Check_async", - "title": "QuotaController check Sample", - "origin": "API_DEFINITION", - "description": " Checks whether an operation on a service should be allowed to proceed based on the configuration of the service and related policies. It must be called before the operation is executed. If feasible, the client should cache the check results and reuse them for 60 seconds. In case of any server errors, the client should rely on the cached results for much longer time to avoid outage. WARNING: There is general 60s delay for the configuration and policy propagation, therefore callers MUST NOT depend on the `Check` method having the latest policy information. NOTE: the [CheckRequest][google.api.servicecontrol.v1.CheckRequest] has the size limit (wire-format byte size) of 1MB. This method requires the `servicemanagement.services.check` permission on the specified service. For more information, see [Cloud IAM](https://cloud.google.com/iam).", - "canonical": true, - "file": "service_controller.check.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 64, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "Check", - "fullName": "google.api.servicecontrol.v1.ServiceController.Check", - "async": true, - "parameters": [ - { - "name": "service_name", - "type": "TYPE_STRING" - }, - { - "name": "operation", - "type": ".google.api.servicecontrol.v1.Operation" - }, - { - "name": "service_config_id", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.api.servicecontrol.v1.CheckResponse", - "client": { - "shortName": "ServiceControllerClient", - "fullName": "google.api.servicecontrol.v1.ServiceControllerClient" - }, - "method": { - "shortName": "Check", - "fullName": "google.api.servicecontrol.v1.ServiceController.Check", - "service": { - "shortName": "ServiceController", - "fullName": "google.api.servicecontrol.v1.ServiceController" - } - } - } - }, - { - "regionTag": "servicecontrol_v1_generated_ServiceController_Report_async", - "title": "QuotaController report Sample", - "origin": "API_DEFINITION", - "description": " Reports operation results to Google Service Control, such as logs and metrics. It should be called after an operation is completed. If feasible, the client should aggregate reporting data for up to 5 seconds to reduce API traffic. Limiting aggregation to 5 seconds is to reduce data loss during client crashes. Clients should carefully choose the aggregation time window to avoid data loss risk more than 0.01% for business and compliance reasons. NOTE: the [ReportRequest][google.api.servicecontrol.v1.ReportRequest] has the size limit (wire-format byte size) of 1MB. This method requires the `servicemanagement.services.report` permission on the specified service. For more information, see [Google Cloud IAM](https://cloud.google.com/iam).", - "canonical": true, - "file": "service_controller.report.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 72, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "Report", - "fullName": "google.api.servicecontrol.v1.ServiceController.Report", - "async": true, - "parameters": [ - { - "name": "service_name", - "type": "TYPE_STRING" - }, - { - "name": "operations", - "type": "TYPE_MESSAGE[]" - }, - { - "name": "service_config_id", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.api.servicecontrol.v1.ReportResponse", - "client": { - "shortName": "ServiceControllerClient", - "fullName": "google.api.servicecontrol.v1.ServiceControllerClient" - }, - "method": { - "shortName": "Report", - "fullName": "google.api.servicecontrol.v1.ServiceController.Report", - "service": { - "shortName": "ServiceController", - "fullName": "google.api.servicecontrol.v1.ServiceController" - } - } - } - } - ] -} diff --git a/owl-bot-staging/v1/src/index.ts b/owl-bot-staging/v1/src/index.ts deleted file mode 100644 index 146ff76..0000000 --- a/owl-bot-staging/v1/src/index.ts +++ /dev/null @@ -1,27 +0,0 @@ -// Copyright 2022 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 QuotaControllerClient = v1.QuotaControllerClient; -type QuotaControllerClient = v1.QuotaControllerClient; -const ServiceControllerClient = v1.ServiceControllerClient; -type ServiceControllerClient = v1.ServiceControllerClient; -export {v1, QuotaControllerClient, ServiceControllerClient}; -export default {v1, QuotaControllerClient, ServiceControllerClient}; -import * as protos from '../protos/protos'; -export {protos} diff --git a/owl-bot-staging/v1/src/v1/gapic_metadata.json b/owl-bot-staging/v1/src/v1/gapic_metadata.json deleted file mode 100644 index 9fc6596..0000000 --- a/owl-bot-staging/v1/src/v1/gapic_metadata.json +++ /dev/null @@ -1,67 +0,0 @@ -{ - "schema": "1.0", - "comment": "This file maps proto services/RPCs to the corresponding library clients/methods", - "language": "typescript", - "protoPackage": "google.api.servicecontrol.v1", - "libraryPackage": "@google-cloud/service-control", - "services": { - "QuotaController": { - "clients": { - "grpc": { - "libraryClient": "QuotaControllerClient", - "rpcs": { - "AllocateQuota": { - "methods": [ - "allocateQuota" - ] - } - } - }, - "grpc-fallback": { - "libraryClient": "QuotaControllerClient", - "rpcs": { - "AllocateQuota": { - "methods": [ - "allocateQuota" - ] - } - } - } - } - }, - "ServiceController": { - "clients": { - "grpc": { - "libraryClient": "ServiceControllerClient", - "rpcs": { - "Check": { - "methods": [ - "check" - ] - }, - "Report": { - "methods": [ - "report" - ] - } - } - }, - "grpc-fallback": { - "libraryClient": "ServiceControllerClient", - "rpcs": { - "Check": { - "methods": [ - "check" - ] - }, - "Report": { - "methods": [ - "report" - ] - } - } - } - } - } - } -} diff --git a/owl-bot-staging/v1/src/v1/index.ts b/owl-bot-staging/v1/src/v1/index.ts deleted file mode 100644 index cc86d9f..0000000 --- a/owl-bot-staging/v1/src/v1/index.ts +++ /dev/null @@ -1,20 +0,0 @@ -// Copyright 2022 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 {QuotaControllerClient} from './quota_controller_client'; -export {ServiceControllerClient} from './service_controller_client'; diff --git a/owl-bot-staging/v1/src/v1/quota_controller_client.ts b/owl-bot-staging/v1/src/v1/quota_controller_client.ts deleted file mode 100644 index 5982e8b..0000000 --- a/owl-bot-staging/v1/src/v1/quota_controller_client.ts +++ /dev/null @@ -1,386 +0,0 @@ -// Copyright 2022 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 * as gax from 'google-gax'; -import {Callback, CallOptions, Descriptors, ClientOptions} from 'google-gax'; - -import * as protos from '../../protos/protos'; -import jsonProtos = require('../../protos/protos.json'); -/** - * Client JSON configuration object, loaded from - * `src/v1/quota_controller_client_config.json`. - * This file defines retry strategy and timeouts for all API methods in this library. - */ -import * as gapicConfig from './quota_controller_client_config.json'; - -const version = require('../../../package.json').version; - -/** - * [Google Quota Control API](/service-control/overview) - * - * Allows clients to allocate and release quota against a [managed - * service](https://cloud.google.com/service-management/reference/rpc/google.api/servicemanagement.v1#google.api.servicemanagement.v1.ManagedService). - * @class - * @memberof v1 - */ -export class QuotaControllerClient { - 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}; - quotaControllerStub?: Promise<{[name: string]: Function}>; - - /** - * Construct an instance of QuotaControllerClient. - * - * @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}. - */ - constructor(opts?: ClientOptions) { - // Ensure that options include all the required fields. - const staticMembers = this.constructor as typeof QuotaControllerClient; - 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); - - // 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; - } - - // Choose either gRPC or proto-over-HTTP implementation of google-gax. - this._gaxModule = opts.fallback ? gax.fallback : gax; - - // 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); - - // Put together the default options sent with requests. - this._defaults = this._gaxGrpc.constructSettings( - 'google.api.servicecontrol.v1.QuotaController', 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 = gax.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.quotaControllerStub) { - return this.quotaControllerStub; - } - - // Put together the "service stub" for - // google.api.servicecontrol.v1.QuotaController. - this.quotaControllerStub = this._gaxGrpc.createStub( - this._opts.fallback ? - (this._protos as protobuf.Root).lookupService('google.api.servicecontrol.v1.QuotaController') : - // eslint-disable-next-line @typescript-eslint/no-explicit-any - (this._protos as any).google.api.servicecontrol.v1.QuotaController, - 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 quotaControllerStubMethods = - ['allocateQuota']; - for (const methodName of quotaControllerStubMethods) { - const callPromise = this.quotaControllerStub.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 = - undefined; - const apiCall = this._gaxModule.createApiCall( - callPromise, - this._defaults[methodName], - descriptor - ); - - this.innerApiCalls[methodName] = apiCall; - } - - return this.quotaControllerStub; - } - - /** - * The DNS address for this API service. - * @returns {string} The DNS address for this service. - */ - static get servicePath() { - return 'servicecontrol.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 'servicecontrol.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/cloud-platform', - 'https://www.googleapis.com/auth/servicecontrol' - ]; - } - - 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 -- - // ------------------- -/** - * Attempts to allocate quota for the specified consumer. It should be called - * before the operation is executed. - * - * This method requires the `servicemanagement.services.quota` - * permission on the specified service. For more information, see - * [Cloud IAM](https://cloud.google.com/iam). - * - * **NOTE:** The client **must** fail-open on server errors `INTERNAL`, - * `UNKNOWN`, `DEADLINE_EXCEEDED`, and `UNAVAILABLE`. To ensure system - * reliability, the server may inject these errors to prohibit any hard - * dependency on the quota functionality. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.serviceName - * Name of the service as specified in the service configuration. For example, - * `"pubsub.googleapis.com"`. - * - * See {@link google.api.Service|google.api.Service} for the definition of a service name. - * @param {google.api.servicecontrol.v1.QuotaOperation} request.allocateOperation - * Operation that describes the quota allocation. - * @param {string} request.serviceConfigId - * Specifies which version of service configuration should be used to process - * the request. If unspecified or no matching version can be found, the latest - * one will be used. - * @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 [AllocateQuotaResponse]{@link google.api.servicecontrol.v1.AllocateQuotaResponse}. - * 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/quota_controller.allocate_quota.js - * region_tag:servicecontrol_v1_generated_QuotaController_AllocateQuota_async - */ - allocateQuota( - request?: protos.google.api.servicecontrol.v1.IAllocateQuotaRequest, - options?: CallOptions): - Promise<[ - protos.google.api.servicecontrol.v1.IAllocateQuotaResponse, - protos.google.api.servicecontrol.v1.IAllocateQuotaRequest|undefined, {}|undefined - ]>; - allocateQuota( - request: protos.google.api.servicecontrol.v1.IAllocateQuotaRequest, - options: CallOptions, - callback: Callback< - protos.google.api.servicecontrol.v1.IAllocateQuotaResponse, - protos.google.api.servicecontrol.v1.IAllocateQuotaRequest|null|undefined, - {}|null|undefined>): void; - allocateQuota( - request: protos.google.api.servicecontrol.v1.IAllocateQuotaRequest, - callback: Callback< - protos.google.api.servicecontrol.v1.IAllocateQuotaResponse, - protos.google.api.servicecontrol.v1.IAllocateQuotaRequest|null|undefined, - {}|null|undefined>): void; - allocateQuota( - request?: protos.google.api.servicecontrol.v1.IAllocateQuotaRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.api.servicecontrol.v1.IAllocateQuotaResponse, - protos.google.api.servicecontrol.v1.IAllocateQuotaRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.api.servicecontrol.v1.IAllocateQuotaResponse, - protos.google.api.servicecontrol.v1.IAllocateQuotaRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.api.servicecontrol.v1.IAllocateQuotaResponse, - protos.google.api.servicecontrol.v1.IAllocateQuotaRequest|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' - ] = gax.routingHeader.fromParams({ - 'service_name': request.serviceName || '', - }); - this.initialize(); - return this.innerApiCalls.allocateQuota(request, options, callback); - } - - - /** - * 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.quotaControllerStub && !this._terminated) { - return this.quotaControllerStub.then(stub => { - this._terminated = true; - stub.close(); - }); - } - return Promise.resolve(); - } -} diff --git a/owl-bot-staging/v1/src/v1/quota_controller_client_config.json b/owl-bot-staging/v1/src/v1/quota_controller_client_config.json deleted file mode 100644 index 61ecf93..0000000 --- a/owl-bot-staging/v1/src/v1/quota_controller_client_config.json +++ /dev/null @@ -1,30 +0,0 @@ -{ - "interfaces": { - "google.api.servicecontrol.v1.QuotaController": { - "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": { - "AllocateQuota": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - } - } - } - } -} diff --git a/owl-bot-staging/v1/src/v1/quota_controller_proto_list.json b/owl-bot-staging/v1/src/v1/quota_controller_proto_list.json deleted file mode 100644 index a93106a..0000000 --- a/owl-bot-staging/v1/src/v1/quota_controller_proto_list.json +++ /dev/null @@ -1,11 +0,0 @@ -[ - "../../protos/google/api/servicecontrol/v1/check_error.proto", - "../../protos/google/api/servicecontrol/v1/distribution.proto", - "../../protos/google/api/servicecontrol/v1/http_request.proto", - "../../protos/google/api/servicecontrol/v1/log_entry.proto", - "../../protos/google/api/servicecontrol/v1/metric_value.proto", - "../../protos/google/api/servicecontrol/v1/operation.proto", - "../../protos/google/api/servicecontrol/v1/quota_controller.proto", - "../../protos/google/api/servicecontrol/v1/service_controller.proto", - "../../protos/google/logging/type/log_severity.proto" -] diff --git a/owl-bot-staging/v1/src/v1/service_controller_client.ts b/owl-bot-staging/v1/src/v1/service_controller_client.ts deleted file mode 100644 index f497562..0000000 --- a/owl-bot-staging/v1/src/v1/service_controller_client.ts +++ /dev/null @@ -1,504 +0,0 @@ -// Copyright 2022 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 * as gax from 'google-gax'; -import {Callback, CallOptions, Descriptors, ClientOptions} from 'google-gax'; - -import * as protos from '../../protos/protos'; -import jsonProtos = require('../../protos/protos.json'); -/** - * Client JSON configuration object, loaded from - * `src/v1/service_controller_client_config.json`. - * This file defines retry strategy and timeouts for all API methods in this library. - */ -import * as gapicConfig from './service_controller_client_config.json'; - -const version = require('../../../package.json').version; - -/** - * [Google Service Control API](/service-control/overview) - * - * Lets clients check and report operations against a [managed - * service](https://cloud.google.com/service-management/reference/rpc/google.api/servicemanagement.v1#google.api.servicemanagement.v1.ManagedService). - * @class - * @memberof v1 - */ -export class ServiceControllerClient { - 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}; - serviceControllerStub?: Promise<{[name: string]: Function}>; - - /** - * Construct an instance of ServiceControllerClient. - * - * @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}. - */ - constructor(opts?: ClientOptions) { - // Ensure that options include all the required fields. - const staticMembers = this.constructor as typeof ServiceControllerClient; - 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); - - // 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; - } - - // Choose either gRPC or proto-over-HTTP implementation of google-gax. - this._gaxModule = opts.fallback ? gax.fallback : gax; - - // 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); - - // Put together the default options sent with requests. - this._defaults = this._gaxGrpc.constructSettings( - 'google.api.servicecontrol.v1.ServiceController', 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 = gax.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.serviceControllerStub) { - return this.serviceControllerStub; - } - - // Put together the "service stub" for - // google.api.servicecontrol.v1.ServiceController. - this.serviceControllerStub = this._gaxGrpc.createStub( - this._opts.fallback ? - (this._protos as protobuf.Root).lookupService('google.api.servicecontrol.v1.ServiceController') : - // eslint-disable-next-line @typescript-eslint/no-explicit-any - (this._protos as any).google.api.servicecontrol.v1.ServiceController, - 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 serviceControllerStubMethods = - ['check', 'report']; - for (const methodName of serviceControllerStubMethods) { - const callPromise = this.serviceControllerStub.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 = - undefined; - const apiCall = this._gaxModule.createApiCall( - callPromise, - this._defaults[methodName], - descriptor - ); - - this.innerApiCalls[methodName] = apiCall; - } - - return this.serviceControllerStub; - } - - /** - * The DNS address for this API service. - * @returns {string} The DNS address for this service. - */ - static get servicePath() { - return 'servicecontrol.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 'servicecontrol.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/cloud-platform', - 'https://www.googleapis.com/auth/servicecontrol' - ]; - } - - 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 -- - // ------------------- -/** - * Checks whether an operation on a service should be allowed to proceed - * based on the configuration of the service and related policies. It must be - * called before the operation is executed. - * - * If feasible, the client should cache the check results and reuse them for - * 60 seconds. In case of any server errors, the client should rely on the - * cached results for much longer time to avoid outage. - * WARNING: There is general 60s delay for the configuration and policy - * propagation, therefore callers MUST NOT depend on the `Check` method having - * the latest policy information. - * - * NOTE: the {@link google.api.servicecontrol.v1.CheckRequest|CheckRequest} has - * the size limit (wire-format byte size) of 1MB. - * - * This method requires the `servicemanagement.services.check` permission - * on the specified service. For more information, see - * [Cloud IAM](https://cloud.google.com/iam). - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.serviceName - * The service name as specified in its service configuration. For example, - * `"pubsub.googleapis.com"`. - * - * See - * [google.api.Service](https://cloud.google.com/service-management/reference/rpc/google.api#google.api.Service) - * for the definition of a service name. - * @param {google.api.servicecontrol.v1.Operation} request.operation - * The operation to be checked. - * @param {string} request.serviceConfigId - * Specifies which version of service configuration should be used to process - * the request. - * - * If unspecified or no matching version can be found, the - * latest one will be used. - * @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 [CheckResponse]{@link google.api.servicecontrol.v1.CheckResponse}. - * 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/service_controller.check.js - * region_tag:servicecontrol_v1_generated_ServiceController_Check_async - */ - check( - request?: protos.google.api.servicecontrol.v1.ICheckRequest, - options?: CallOptions): - Promise<[ - protos.google.api.servicecontrol.v1.ICheckResponse, - protos.google.api.servicecontrol.v1.ICheckRequest|undefined, {}|undefined - ]>; - check( - request: protos.google.api.servicecontrol.v1.ICheckRequest, - options: CallOptions, - callback: Callback< - protos.google.api.servicecontrol.v1.ICheckResponse, - protos.google.api.servicecontrol.v1.ICheckRequest|null|undefined, - {}|null|undefined>): void; - check( - request: protos.google.api.servicecontrol.v1.ICheckRequest, - callback: Callback< - protos.google.api.servicecontrol.v1.ICheckResponse, - protos.google.api.servicecontrol.v1.ICheckRequest|null|undefined, - {}|null|undefined>): void; - check( - request?: protos.google.api.servicecontrol.v1.ICheckRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.api.servicecontrol.v1.ICheckResponse, - protos.google.api.servicecontrol.v1.ICheckRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.api.servicecontrol.v1.ICheckResponse, - protos.google.api.servicecontrol.v1.ICheckRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.api.servicecontrol.v1.ICheckResponse, - protos.google.api.servicecontrol.v1.ICheckRequest|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' - ] = gax.routingHeader.fromParams({ - 'service_name': request.serviceName || '', - }); - this.initialize(); - return this.innerApiCalls.check(request, options, callback); - } -/** - * Reports operation results to Google Service Control, such as logs and - * metrics. It should be called after an operation is completed. - * - * If feasible, the client should aggregate reporting data for up to 5 - * seconds to reduce API traffic. Limiting aggregation to 5 seconds is to - * reduce data loss during client crashes. Clients should carefully choose - * the aggregation time window to avoid data loss risk more than 0.01% - * for business and compliance reasons. - * - * NOTE: the {@link google.api.servicecontrol.v1.ReportRequest|ReportRequest} has - * the size limit (wire-format byte size) of 1MB. - * - * This method requires the `servicemanagement.services.report` permission - * on the specified service. For more information, see - * [Google Cloud IAM](https://cloud.google.com/iam). - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.serviceName - * The service name as specified in its service configuration. For example, - * `"pubsub.googleapis.com"`. - * - * See - * [google.api.Service](https://cloud.google.com/service-management/reference/rpc/google.api#google.api.Service) - * for the definition of a service name. - * @param {number[]} request.operations - * Operations to be reported. - * - * Typically the service should report one operation per request. - * Putting multiple operations into a single request is allowed, but should - * be used only when multiple operations are natually available at the time - * of the report. - * - * There is no limit on the number of operations in the same ReportRequest, - * however the ReportRequest size should be no larger than 1MB. See - * {@link google.api.servicecontrol.v1.ReportResponse.report_errors|ReportResponse.report_errors} - * for partial failure behavior. - * @param {string} request.serviceConfigId - * Specifies which version of service config should be used to process the - * request. - * - * If unspecified or no matching version can be found, the - * latest one will be used. - * @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 [ReportResponse]{@link google.api.servicecontrol.v1.ReportResponse}. - * 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/service_controller.report.js - * region_tag:servicecontrol_v1_generated_ServiceController_Report_async - */ - report( - request?: protos.google.api.servicecontrol.v1.IReportRequest, - options?: CallOptions): - Promise<[ - protos.google.api.servicecontrol.v1.IReportResponse, - protos.google.api.servicecontrol.v1.IReportRequest|undefined, {}|undefined - ]>; - report( - request: protos.google.api.servicecontrol.v1.IReportRequest, - options: CallOptions, - callback: Callback< - protos.google.api.servicecontrol.v1.IReportResponse, - protos.google.api.servicecontrol.v1.IReportRequest|null|undefined, - {}|null|undefined>): void; - report( - request: protos.google.api.servicecontrol.v1.IReportRequest, - callback: Callback< - protos.google.api.servicecontrol.v1.IReportResponse, - protos.google.api.servicecontrol.v1.IReportRequest|null|undefined, - {}|null|undefined>): void; - report( - request?: protos.google.api.servicecontrol.v1.IReportRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.api.servicecontrol.v1.IReportResponse, - protos.google.api.servicecontrol.v1.IReportRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.api.servicecontrol.v1.IReportResponse, - protos.google.api.servicecontrol.v1.IReportRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.api.servicecontrol.v1.IReportResponse, - protos.google.api.servicecontrol.v1.IReportRequest|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' - ] = gax.routingHeader.fromParams({ - 'service_name': request.serviceName || '', - }); - this.initialize(); - return this.innerApiCalls.report(request, options, callback); - } - - - /** - * 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.serviceControllerStub && !this._terminated) { - return this.serviceControllerStub.then(stub => { - this._terminated = true; - stub.close(); - }); - } - return Promise.resolve(); - } -} diff --git a/owl-bot-staging/v1/src/v1/service_controller_client_config.json b/owl-bot-staging/v1/src/v1/service_controller_client_config.json deleted file mode 100644 index 58af282..0000000 --- a/owl-bot-staging/v1/src/v1/service_controller_client_config.json +++ /dev/null @@ -1,48 +0,0 @@ -{ - "interfaces": { - "google.api.servicecontrol.v1.ServiceController": { - "retry_codes": { - "non_idempotent": [], - "idempotent": [ - "DEADLINE_EXCEEDED", - "UNAVAILABLE" - ], - "unavailable": [ - "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 - }, - "ce5b960a6ed052e690863808e4f0deff3dc7d49f": { - "initial_retry_delay_millis": 1000, - "retry_delay_multiplier": 1.3, - "max_retry_delay_millis": 10000, - "initial_rpc_timeout_millis": 60000, - "rpc_timeout_multiplier": 1, - "max_rpc_timeout_millis": 60000, - "total_timeout_millis": 600000 - } - }, - "methods": { - "Check": { - "timeout_millis": 5000, - "retry_codes_name": "unavailable", - "retry_params_name": "ce5b960a6ed052e690863808e4f0deff3dc7d49f" - }, - "Report": { - "timeout_millis": 16000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - } - } - } - } -} diff --git a/owl-bot-staging/v1/src/v1/service_controller_proto_list.json b/owl-bot-staging/v1/src/v1/service_controller_proto_list.json deleted file mode 100644 index a93106a..0000000 --- a/owl-bot-staging/v1/src/v1/service_controller_proto_list.json +++ /dev/null @@ -1,11 +0,0 @@ -[ - "../../protos/google/api/servicecontrol/v1/check_error.proto", - "../../protos/google/api/servicecontrol/v1/distribution.proto", - "../../protos/google/api/servicecontrol/v1/http_request.proto", - "../../protos/google/api/servicecontrol/v1/log_entry.proto", - "../../protos/google/api/servicecontrol/v1/metric_value.proto", - "../../protos/google/api/servicecontrol/v1/operation.proto", - "../../protos/google/api/servicecontrol/v1/quota_controller.proto", - "../../protos/google/api/servicecontrol/v1/service_controller.proto", - "../../protos/google/logging/type/log_severity.proto" -] diff --git a/owl-bot-staging/v1/system-test/fixtures/sample/src/index.js b/owl-bot-staging/v1/system-test/fixtures/sample/src/index.js deleted file mode 100644 index 76ec8e2..0000000 --- a/owl-bot-staging/v1/system-test/fixtures/sample/src/index.js +++ /dev/null @@ -1,28 +0,0 @@ -// Copyright 2022 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 servicecontrol = require('@google-cloud/service-control'); - -function main() { - const quotaControllerClient = new servicecontrol.QuotaControllerClient(); - const serviceControllerClient = new servicecontrol.ServiceControllerClient(); -} - -main(); diff --git a/owl-bot-staging/v1/system-test/fixtures/sample/src/index.ts b/owl-bot-staging/v1/system-test/fixtures/sample/src/index.ts deleted file mode 100644 index 7c3f7a3..0000000 --- a/owl-bot-staging/v1/system-test/fixtures/sample/src/index.ts +++ /dev/null @@ -1,38 +0,0 @@ -// Copyright 2022 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 {QuotaControllerClient, ServiceControllerClient} from '@google-cloud/service-control'; - -// check that the client class type name can be used -function doStuffWithQuotaControllerClient(client: QuotaControllerClient) { - client.close(); -} -function doStuffWithServiceControllerClient(client: ServiceControllerClient) { - client.close(); -} - -function main() { - // check that the client instance can be created - const quotaControllerClient = new QuotaControllerClient(); - doStuffWithQuotaControllerClient(quotaControllerClient); - // check that the client instance can be created - const serviceControllerClient = new ServiceControllerClient(); - doStuffWithServiceControllerClient(serviceControllerClient); -} - -main(); diff --git a/owl-bot-staging/v1/system-test/install.ts b/owl-bot-staging/v1/system-test/install.ts deleted file mode 100644 index 8ec4522..0000000 --- a/owl-bot-staging/v1/system-test/install.ts +++ /dev/null @@ -1,49 +0,0 @@ -// Copyright 2022 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/v1/test/gapic_quota_controller_v1.ts b/owl-bot-staging/v1/test/gapic_quota_controller_v1.ts deleted file mode 100644 index 39caa89..0000000 --- a/owl-bot-staging/v1/test/gapic_quota_controller_v1.ts +++ /dev/null @@ -1,232 +0,0 @@ -// Copyright 2022 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 quotacontrollerModule from '../src'; - -import {protobuf} from 'google-gax'; - -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); -} - -describe('v1.QuotaControllerClient', () => { - it('has servicePath', () => { - const servicePath = quotacontrollerModule.v1.QuotaControllerClient.servicePath; - assert(servicePath); - }); - - it('has apiEndpoint', () => { - const apiEndpoint = quotacontrollerModule.v1.QuotaControllerClient.apiEndpoint; - assert(apiEndpoint); - }); - - it('has port', () => { - const port = quotacontrollerModule.v1.QuotaControllerClient.port; - assert(port); - assert(typeof port === 'number'); - }); - - it('should create a client with no option', () => { - const client = new quotacontrollerModule.v1.QuotaControllerClient(); - assert(client); - }); - - it('should create a client with gRPC fallback', () => { - const client = new quotacontrollerModule.v1.QuotaControllerClient({ - fallback: true, - }); - assert(client); - }); - - it('has initialize method and supports deferred initialization', async () => { - const client = new quotacontrollerModule.v1.QuotaControllerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - assert.strictEqual(client.quotaControllerStub, undefined); - await client.initialize(); - assert(client.quotaControllerStub); - }); - - it('has close method for the initialized client', done => { - const client = new quotacontrollerModule.v1.QuotaControllerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - assert(client.quotaControllerStub); - client.close().then(() => { - done(); - }); - }); - - it('has close method for the non-initialized client', done => { - const client = new quotacontrollerModule.v1.QuotaControllerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - assert.strictEqual(client.quotaControllerStub, undefined); - client.close().then(() => { - done(); - }); - }); - - it('has getProjectId method', async () => { - const fakeProjectId = 'fake-project-id'; - const client = new quotacontrollerModule.v1.QuotaControllerClient({ - 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 quotacontrollerModule.v1.QuotaControllerClient({ - 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('allocateQuota', () => { - it('invokes allocateQuota without error', async () => { - const client = new quotacontrollerModule.v1.QuotaControllerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.api.servicecontrol.v1.AllocateQuotaRequest()); - request.serviceName = ''; - const expectedHeaderRequestParams = "service_name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.api.servicecontrol.v1.AllocateQuotaResponse()); - client.innerApiCalls.allocateQuota = stubSimpleCall(expectedResponse); - const [response] = await client.allocateQuota(request); - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.allocateQuota as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes allocateQuota without error using callback', async () => { - const client = new quotacontrollerModule.v1.QuotaControllerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.api.servicecontrol.v1.AllocateQuotaRequest()); - request.serviceName = ''; - const expectedHeaderRequestParams = "service_name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.api.servicecontrol.v1.AllocateQuotaResponse()); - client.innerApiCalls.allocateQuota = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.allocateQuota( - request, - (err?: Error|null, result?: protos.google.api.servicecontrol.v1.IAllocateQuotaResponse|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.allocateQuota as SinonStub) - .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); - }); - - it('invokes allocateQuota with error', async () => { - const client = new quotacontrollerModule.v1.QuotaControllerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.api.servicecontrol.v1.AllocateQuotaRequest()); - request.serviceName = ''; - const expectedHeaderRequestParams = "service_name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.innerApiCalls.allocateQuota = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.allocateQuota(request), expectedError); - assert((client.innerApiCalls.allocateQuota as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes allocateQuota with closed client', async () => { - const client = new quotacontrollerModule.v1.QuotaControllerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.api.servicecontrol.v1.AllocateQuotaRequest()); - request.serviceName = ''; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.allocateQuota(request), expectedError); - }); - }); -}); diff --git a/owl-bot-staging/v1/test/gapic_service_controller_v1.ts b/owl-bot-staging/v1/test/gapic_service_controller_v1.ts deleted file mode 100644 index 74a01cf..0000000 --- a/owl-bot-staging/v1/test/gapic_service_controller_v1.ts +++ /dev/null @@ -1,329 +0,0 @@ -// Copyright 2022 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 servicecontrollerModule from '../src'; - -import {protobuf} from 'google-gax'; - -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); -} - -describe('v1.ServiceControllerClient', () => { - it('has servicePath', () => { - const servicePath = servicecontrollerModule.v1.ServiceControllerClient.servicePath; - assert(servicePath); - }); - - it('has apiEndpoint', () => { - const apiEndpoint = servicecontrollerModule.v1.ServiceControllerClient.apiEndpoint; - assert(apiEndpoint); - }); - - it('has port', () => { - const port = servicecontrollerModule.v1.ServiceControllerClient.port; - assert(port); - assert(typeof port === 'number'); - }); - - it('should create a client with no option', () => { - const client = new servicecontrollerModule.v1.ServiceControllerClient(); - assert(client); - }); - - it('should create a client with gRPC fallback', () => { - const client = new servicecontrollerModule.v1.ServiceControllerClient({ - fallback: true, - }); - assert(client); - }); - - it('has initialize method and supports deferred initialization', async () => { - const client = new servicecontrollerModule.v1.ServiceControllerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - assert.strictEqual(client.serviceControllerStub, undefined); - await client.initialize(); - assert(client.serviceControllerStub); - }); - - it('has close method for the initialized client', done => { - const client = new servicecontrollerModule.v1.ServiceControllerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - assert(client.serviceControllerStub); - client.close().then(() => { - done(); - }); - }); - - it('has close method for the non-initialized client', done => { - const client = new servicecontrollerModule.v1.ServiceControllerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - assert.strictEqual(client.serviceControllerStub, undefined); - client.close().then(() => { - done(); - }); - }); - - it('has getProjectId method', async () => { - const fakeProjectId = 'fake-project-id'; - const client = new servicecontrollerModule.v1.ServiceControllerClient({ - 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 servicecontrollerModule.v1.ServiceControllerClient({ - 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('check', () => { - it('invokes check without error', async () => { - const client = new servicecontrollerModule.v1.ServiceControllerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.api.servicecontrol.v1.CheckRequest()); - request.serviceName = ''; - const expectedHeaderRequestParams = "service_name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.api.servicecontrol.v1.CheckResponse()); - client.innerApiCalls.check = stubSimpleCall(expectedResponse); - const [response] = await client.check(request); - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.check as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes check without error using callback', async () => { - const client = new servicecontrollerModule.v1.ServiceControllerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.api.servicecontrol.v1.CheckRequest()); - request.serviceName = ''; - const expectedHeaderRequestParams = "service_name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.api.servicecontrol.v1.CheckResponse()); - client.innerApiCalls.check = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.check( - request, - (err?: Error|null, result?: protos.google.api.servicecontrol.v1.ICheckResponse|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.check as SinonStub) - .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); - }); - - it('invokes check with error', async () => { - const client = new servicecontrollerModule.v1.ServiceControllerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.api.servicecontrol.v1.CheckRequest()); - request.serviceName = ''; - const expectedHeaderRequestParams = "service_name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.innerApiCalls.check = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.check(request), expectedError); - assert((client.innerApiCalls.check as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes check with closed client', async () => { - const client = new servicecontrollerModule.v1.ServiceControllerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.api.servicecontrol.v1.CheckRequest()); - request.serviceName = ''; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.check(request), expectedError); - }); - }); - - describe('report', () => { - it('invokes report without error', async () => { - const client = new servicecontrollerModule.v1.ServiceControllerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.api.servicecontrol.v1.ReportRequest()); - request.serviceName = ''; - const expectedHeaderRequestParams = "service_name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.api.servicecontrol.v1.ReportResponse()); - client.innerApiCalls.report = stubSimpleCall(expectedResponse); - const [response] = await client.report(request); - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.report as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes report without error using callback', async () => { - const client = new servicecontrollerModule.v1.ServiceControllerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.api.servicecontrol.v1.ReportRequest()); - request.serviceName = ''; - const expectedHeaderRequestParams = "service_name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.api.servicecontrol.v1.ReportResponse()); - client.innerApiCalls.report = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.report( - request, - (err?: Error|null, result?: protos.google.api.servicecontrol.v1.IReportResponse|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.report as SinonStub) - .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); - }); - - it('invokes report with error', async () => { - const client = new servicecontrollerModule.v1.ServiceControllerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.api.servicecontrol.v1.ReportRequest()); - request.serviceName = ''; - const expectedHeaderRequestParams = "service_name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.innerApiCalls.report = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.report(request), expectedError); - assert((client.innerApiCalls.report as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes report with closed client', async () => { - const client = new servicecontrollerModule.v1.ServiceControllerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.api.servicecontrol.v1.ReportRequest()); - request.serviceName = ''; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.report(request), expectedError); - }); - }); -}); diff --git a/owl-bot-staging/v1/tsconfig.json b/owl-bot-staging/v1/tsconfig.json deleted file mode 100644 index c78f1c8..0000000 --- a/owl-bot-staging/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/v1/webpack.config.js b/owl-bot-staging/v1/webpack.config.js deleted file mode 100644 index a206a37..0000000 --- a/owl-bot-staging/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: 'QuotaController', - filename: './quota-controller.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/owl-bot-staging/v2/.eslintignore b/owl-bot-staging/v2/.eslintignore deleted file mode 100644 index cfc348e..0000000 --- a/owl-bot-staging/v2/.eslintignore +++ /dev/null @@ -1,7 +0,0 @@ -**/node_modules -**/.coverage -build/ -docs/ -protos/ -system-test/ -samples/generated/ diff --git a/owl-bot-staging/v2/.eslintrc.json b/owl-bot-staging/v2/.eslintrc.json deleted file mode 100644 index 7821534..0000000 --- a/owl-bot-staging/v2/.eslintrc.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "extends": "./node_modules/gts" -} diff --git a/owl-bot-staging/v2/.gitignore b/owl-bot-staging/v2/.gitignore deleted file mode 100644 index 5d32b23..0000000 --- a/owl-bot-staging/v2/.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/v2/.jsdoc.js b/owl-bot-staging/v2/.jsdoc.js deleted file mode 100644 index e0f354d..0000000 --- a/owl-bot-staging/v2/.jsdoc.js +++ /dev/null @@ -1,55 +0,0 @@ -// Copyright 2022 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 2022 Google LLC', - includeDate: false, - sourceFiles: false, - systemName: '@google-cloud/servicecontrol', - theme: 'lumen', - default: { - outputSourceFiles: false - } - }, - markdown: { - idInHeadings: true - } -}; diff --git a/owl-bot-staging/v2/.mocharc.js b/owl-bot-staging/v2/.mocharc.js deleted file mode 100644 index 481c522..0000000 --- a/owl-bot-staging/v2/.mocharc.js +++ /dev/null @@ -1,33 +0,0 @@ -// Copyright 2022 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/v2/.prettierrc.js b/owl-bot-staging/v2/.prettierrc.js deleted file mode 100644 index 494e147..0000000 --- a/owl-bot-staging/v2/.prettierrc.js +++ /dev/null @@ -1,22 +0,0 @@ -// Copyright 2022 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/v2/README.md b/owl-bot-staging/v2/README.md deleted file mode 100644 index 369bd39..0000000 --- a/owl-bot-staging/v2/README.md +++ /dev/null @@ -1 +0,0 @@ -Servicecontrol: Nodejs Client diff --git a/owl-bot-staging/v2/linkinator.config.json b/owl-bot-staging/v2/linkinator.config.json deleted file mode 100644 index befd23c..0000000 --- a/owl-bot-staging/v2/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/v2/package.json b/owl-bot-staging/v2/package.json deleted file mode 100644 index ea4791b..0000000 --- a/owl-bot-staging/v2/package.json +++ /dev/null @@ -1,64 +0,0 @@ -{ - "name": "@google-cloud/servicecontrol", - "version": "0.1.0", - "description": "Servicecontrol client for Node.js", - "repository": "googleapis/nodejs-servicecontrol", - "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 servicecontrol", - "servicecontrol", - "service controller" - ], - "scripts": { - "clean": "gts clean", - "compile": "tsc -p . && cp -r protos build/", - "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.1.1" - }, - "devDependencies": { - "@types/mocha": "^9.1.0", - "@types/node": "^16.0.0", - "@types/sinon": "^10.0.8", - "c8": "^7.11.0", - "gts": "^3.1.0", - "jsdoc": "^3.6.7", - "jsdoc-fresh": "^1.1.1", - "jsdoc-region-tag": "^1.3.1", - "linkinator": "^3.0.0", - "mocha": "^9.1.4", - "null-loader": "^4.0.1", - "pack-n-play": "^1.0.0-2", - "sinon": "^13.0.0", - "ts-loader": "^9.2.6", - "typescript": "^4.5.5", - "webpack": "^5.67.0", - "webpack-cli": "^4.9.1" - }, - "engines": { - "node": ">=v12" - } -} diff --git a/owl-bot-staging/v2/protos/google/api/servicecontrol/v2/service_controller.proto b/owl-bot-staging/v2/protos/google/api/servicecontrol/v2/service_controller.proto deleted file mode 100644 index 2e2112e..0000000 --- a/owl-bot-staging/v2/protos/google/api/servicecontrol/v2/service_controller.proto +++ /dev/null @@ -1,190 +0,0 @@ -// Copyright 2022 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.api.servicecontrol.v2; - -import "google/api/annotations.proto"; -import "google/api/client.proto"; -import "google/rpc/context/attribute_context.proto"; -import "google/rpc/status.proto"; - -option cc_enable_arenas = true; -option csharp_namespace = "Google.Cloud.ServiceControl.V2"; -option go_package = "google.golang.org/genproto/googleapis/api/servicecontrol/v2;servicecontrol"; -option java_multiple_files = true; -option java_outer_classname = "ServiceControllerProto"; -option java_package = "com.google.api.servicecontrol.v2"; -option objc_class_prefix = "GASC"; -option php_namespace = "Google\\Cloud\\ServiceControl\\V2"; -option ruby_package = "Google::Cloud::ServiceControl::V2"; - -// [Service Control API -// v2](https://cloud.google.com/service-infrastructure/docs/service-control/access-control) -// -// Private Preview. This feature is only available for approved services. -// -// This API provides admission control and telemetry reporting for services -// that are integrated with [Service -// Infrastructure](https://cloud.google.com/service-infrastructure). -service ServiceController { - option (google.api.default_host) = "servicecontrol.googleapis.com"; - option (google.api.oauth_scopes) = - "https://www.googleapis.com/auth/cloud-platform," - "https://www.googleapis.com/auth/servicecontrol"; - - // Private Preview. This feature is only available for approved services. - // - // This method provides admission control for services that are integrated - // with [Service - // Infrastructure](https://cloud.google.com/service-infrastructure). It checks - // whether an operation should be allowed based on the service configuration - // and relevant policies. It must be called before the operation is executed. - // For more information, see - // [Admission - // Control](https://cloud.google.com/service-infrastructure/docs/admission-control). - // - // NOTE: The admission control has an expected policy propagation delay of - // 60s. The caller **must** not depend on the most recent policy changes. - // - // NOTE: The admission control has a hard limit of 1 referenced resources - // per call. If an operation refers to more than 1 resources, the caller - // must call the Check method multiple times. - // - // This method requires the `servicemanagement.services.check` permission - // on the specified service. For more information, see - // [Service Control API Access - // Control](https://cloud.google.com/service-infrastructure/docs/service-control/access-control). - rpc Check(CheckRequest) returns (CheckResponse) { - option (google.api.http) = { - post: "/v2/services/{service_name}:check" - body: "*" - }; - } - - // Private Preview. This feature is only available for approved services. - // - // This method provides telemetry reporting for services that are integrated - // with [Service - // Infrastructure](https://cloud.google.com/service-infrastructure). It - // reports a list of operations that have occurred on a service. It must be - // called after the operations have been executed. For more information, see - // [Telemetry - // Reporting](https://cloud.google.com/service-infrastructure/docs/telemetry-reporting). - // - // NOTE: The telemetry reporting has a hard limit of 1000 operations and 1MB - // per Report call. It is recommended to have no more than 100 operations per - // call. - // - // This method requires the `servicemanagement.services.report` permission - // on the specified service. For more information, see - // [Service Control API Access - // Control](https://cloud.google.com/service-infrastructure/docs/service-control/access-control). - rpc Report(ReportRequest) returns (ReportResponse) { - option (google.api.http) = { - post: "/v2/services/{service_name}:report" - body: "*" - }; - } -} - -// Request message for the Check method. -message CheckRequest { - // The service name as specified in its service configuration. For example, - // `"pubsub.googleapis.com"`. - // - // See - // [google.api.Service](https://cloud.google.com/service-management/reference/rpc/google.api#google.api.Service) - // for the definition of a service name. - string service_name = 1; - - // Specifies the version of the service configuration that should be used to - // process the request. Must not be empty. Set this field to 'latest' to - // specify using the latest configuration. - string service_config_id = 2; - - // Describes attributes about the operation being executed by the service. - google.rpc.context.AttributeContext attributes = 3; - - // Describes the resources and the policies applied to each resource. - repeated ResourceInfo resources = 4; - - // Optional. Contains a comma-separated list of flags. - string flags = 5; -} - -// Describes a resource referenced in the request. -message ResourceInfo { - // The name of the resource referenced in the request. - string name = 1; - - // The resource type in the format of "{service}/{kind}". - string type = 2; - - // The resource permission needed for this request. - // The format must be "{service}/{plural}.{verb}". - string permission = 3; - - // Optional. The identifier of the container of this resource. For Google - // Cloud APIs, the resource container must be one of the following formats: - // - `projects/` - // - `folders/` - // - `organizations/` - // For the policy enforcement on the container level (VPCSC and Location - // Policy check), this field takes precedence on the container extracted from - // name when presents. - string container = 4; - - // Optional. The location of the resource. The value must be a valid zone, - // region or multiregion. For example: "europe-west4" or - // "northamerica-northeast1-a" - string location = 5; -} - -// Response message for the Check method. -message CheckResponse { - // Operation is allowed when this field is not set. Any non-'OK' status - // indicates a denial; [google.rpc.Status.details][google.rpc.Status.details] - // would contain additional details about the denial. - google.rpc.Status status = 1; - - // Returns a set of request contexts generated from the `CheckRequest`. - map headers = 2; -} - -// Request message for the Report method. -message ReportRequest { - // The service name as specified in its service configuration. For example, - // `"pubsub.googleapis.com"`. - // - // See - // [google.api.Service](https://cloud.google.com/service-management/reference/rpc/google.api#google.api.Service) - // for the definition of a service name. - string service_name = 1; - - // Specifies the version of the service configuration that should be used to - // process the request. Must not be empty. Set this field to 'latest' to - // specify using the latest configuration. - string service_config_id = 2; - - // Describes the list of operations to be reported. Each operation is - // represented as an AttributeContext, and contains all attributes around an - // API access. - repeated google.rpc.context.AttributeContext operations = 3; -} - -// Response message for the Report method. -// If the request contains any invalid data, the server returns an RPC error. -message ReportResponse {} diff --git a/owl-bot-staging/v2/samples/generated/v2/service_controller.check.js b/owl-bot-staging/v2/samples/generated/v2/service_controller.check.js deleted file mode 100644 index 35fa9a7..0000000 --- a/owl-bot-staging/v2/samples/generated/v2/service_controller.check.js +++ /dev/null @@ -1,79 +0,0 @@ -// Copyright 2022 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 servicecontrol_v2_generated_ServiceController_Check_async] - /** - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * The service name as specified in its service configuration. For example, - * `"pubsub.googleapis.com"`. - * See - * google.api.Service (https://cloud.google.com/service-management/reference/rpc/google.api#google.api.Service) - * for the definition of a service name. - */ - // const serviceName = 'abc123' - /** - * Specifies the version of the service configuration that should be used to - * process the request. Must not be empty. Set this field to 'latest' to - * specify using the latest configuration. - */ - // const serviceConfigId = 'abc123' - /** - * Describes attributes about the operation being executed by the service. - */ - // const attributes = {} - /** - * Describes the resources and the policies applied to each resource. - */ - // const resources = 1234 - /** - * Optional. Contains a comma-separated list of flags. - */ - // const flags = 'abc123' - - // Imports the Servicecontrol library - const {ServiceControllerClient} = require('@google-cloud/servicecontrol').v2; - - // Instantiates a client - const servicecontrolClient = new ServiceControllerClient(); - - async function callCheck() { - // Construct request - const request = { - }; - - // Run request - const response = await servicecontrolClient.check(request); - console.log(response); - } - - callCheck(); - // [END servicecontrol_v2_generated_ServiceController_Check_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/v2/samples/generated/v2/service_controller.report.js b/owl-bot-staging/v2/samples/generated/v2/service_controller.report.js deleted file mode 100644 index af0b8c0..0000000 --- a/owl-bot-staging/v2/samples/generated/v2/service_controller.report.js +++ /dev/null @@ -1,73 +0,0 @@ -// Copyright 2022 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 servicecontrol_v2_generated_ServiceController_Report_async] - /** - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * The service name as specified in its service configuration. For example, - * `"pubsub.googleapis.com"`. - * See - * google.api.Service (https://cloud.google.com/service-management/reference/rpc/google.api#google.api.Service) - * for the definition of a service name. - */ - // const serviceName = 'abc123' - /** - * Specifies the version of the service configuration that should be used to - * process the request. Must not be empty. Set this field to 'latest' to - * specify using the latest configuration. - */ - // const serviceConfigId = 'abc123' - /** - * Describes the list of operations to be reported. Each operation is - * represented as an AttributeContext, and contains all attributes around an - * API access. - */ - // const operations = 1234 - - // Imports the Servicecontrol library - const {ServiceControllerClient} = require('@google-cloud/servicecontrol').v2; - - // Instantiates a client - const servicecontrolClient = new ServiceControllerClient(); - - async function callReport() { - // Construct request - const request = { - }; - - // Run request - const response = await servicecontrolClient.report(request); - console.log(response); - } - - callReport(); - // [END servicecontrol_v2_generated_ServiceController_Report_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/v2/samples/generated/v2/snippet_metadata.google.api.servicecontrol.v2.json b/owl-bot-staging/v2/samples/generated/v2/snippet_metadata.google.api.servicecontrol.v2.json deleted file mode 100644 index d482e6e..0000000 --- a/owl-bot-staging/v2/samples/generated/v2/snippet_metadata.google.api.servicecontrol.v2.json +++ /dev/null @@ -1,119 +0,0 @@ -{ - "clientLibrary": { - "name": "nodejs-servicecontrol", - "version": "0.1.0", - "language": "TYPESCRIPT", - "apis": [ - { - "id": "google.api.servicecontrol.v2", - "version": "v2" - } - ] - }, - "snippets": [ - { - "regionTag": "servicecontrol_v2_generated_ServiceController_Check_async", - "title": "ServiceController check Sample", - "origin": "API_DEFINITION", - "description": " Private Preview. This feature is only available for approved services. This method provides admission control for services that are integrated with [Service Infrastructure](https://cloud.google.com/service-infrastructure). It checks whether an operation should be allowed based on the service configuration and relevant policies. It must be called before the operation is executed. For more information, see [Admission Control](https://cloud.google.com/service-infrastructure/docs/admission-control). NOTE: The admission control has an expected policy propagation delay of 60s. The caller **must** not depend on the most recent policy changes. NOTE: The admission control has a hard limit of 1 referenced resources per call. If an operation refers to more than 1 resources, the caller must call the Check method multiple times. This method requires the `servicemanagement.services.check` permission on the specified service. For more information, see [Service Control API Access Control](https://cloud.google.com/service-infrastructure/docs/service-control/access-control).", - "canonical": true, - "file": "service_controller.check.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 71, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "Check", - "fullName": "google.api.servicecontrol.v2.ServiceController.Check", - "async": true, - "parameters": [ - { - "name": "service_name", - "type": "TYPE_STRING" - }, - { - "name": "service_config_id", - "type": "TYPE_STRING" - }, - { - "name": "attributes", - "type": ".google.rpc.context.AttributeContext" - }, - { - "name": "resources", - "type": "TYPE_MESSAGE[]" - }, - { - "name": "flags", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.api.servicecontrol.v2.CheckResponse", - "client": { - "shortName": "ServiceControllerClient", - "fullName": "google.api.servicecontrol.v2.ServiceControllerClient" - }, - "method": { - "shortName": "Check", - "fullName": "google.api.servicecontrol.v2.ServiceController.Check", - "service": { - "shortName": "ServiceController", - "fullName": "google.api.servicecontrol.v2.ServiceController" - } - } - } - }, - { - "regionTag": "servicecontrol_v2_generated_ServiceController_Report_async", - "title": "ServiceController report Sample", - "origin": "API_DEFINITION", - "description": " Private Preview. This feature is only available for approved services. This method provides telemetry reporting for services that are integrated with [Service Infrastructure](https://cloud.google.com/service-infrastructure). It reports a list of operations that have occurred on a service. It must be called after the operations have been executed. For more information, see [Telemetry Reporting](https://cloud.google.com/service-infrastructure/docs/telemetry-reporting). NOTE: The telemetry reporting has a hard limit of 1000 operations and 1MB per Report call. It is recommended to have no more than 100 operations per call. This method requires the `servicemanagement.services.report` permission on the specified service. For more information, see [Service Control API Access Control](https://cloud.google.com/service-infrastructure/docs/service-control/access-control).", - "canonical": true, - "file": "service_controller.report.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 65, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "Report", - "fullName": "google.api.servicecontrol.v2.ServiceController.Report", - "async": true, - "parameters": [ - { - "name": "service_name", - "type": "TYPE_STRING" - }, - { - "name": "service_config_id", - "type": "TYPE_STRING" - }, - { - "name": "operations", - "type": "TYPE_MESSAGE[]" - } - ], - "resultType": ".google.api.servicecontrol.v2.ReportResponse", - "client": { - "shortName": "ServiceControllerClient", - "fullName": "google.api.servicecontrol.v2.ServiceControllerClient" - }, - "method": { - "shortName": "Report", - "fullName": "google.api.servicecontrol.v2.ServiceController.Report", - "service": { - "shortName": "ServiceController", - "fullName": "google.api.servicecontrol.v2.ServiceController" - } - } - } - } - ] -} diff --git a/owl-bot-staging/v2/src/index.ts b/owl-bot-staging/v2/src/index.ts deleted file mode 100644 index 8f96cd6..0000000 --- a/owl-bot-staging/v2/src/index.ts +++ /dev/null @@ -1,25 +0,0 @@ -// Copyright 2022 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 v2 from './v2'; -const ServiceControllerClient = v2.ServiceControllerClient; -type ServiceControllerClient = v2.ServiceControllerClient; -export {v2, ServiceControllerClient}; -export default {v2, ServiceControllerClient}; -import * as protos from '../protos/protos'; -export {protos} diff --git a/owl-bot-staging/v2/src/v2/gapic_metadata.json b/owl-bot-staging/v2/src/v2/gapic_metadata.json deleted file mode 100644 index 1345b12..0000000 --- a/owl-bot-staging/v2/src/v2/gapic_metadata.json +++ /dev/null @@ -1,43 +0,0 @@ -{ - "schema": "1.0", - "comment": "This file maps proto services/RPCs to the corresponding library clients/methods", - "language": "typescript", - "protoPackage": "google.api.servicecontrol.v2", - "libraryPackage": "@google-cloud/servicecontrol", - "services": { - "ServiceController": { - "clients": { - "grpc": { - "libraryClient": "ServiceControllerClient", - "rpcs": { - "Check": { - "methods": [ - "check" - ] - }, - "Report": { - "methods": [ - "report" - ] - } - } - }, - "grpc-fallback": { - "libraryClient": "ServiceControllerClient", - "rpcs": { - "Check": { - "methods": [ - "check" - ] - }, - "Report": { - "methods": [ - "report" - ] - } - } - } - } - } - } -} diff --git a/owl-bot-staging/v2/src/v2/index.ts b/owl-bot-staging/v2/src/v2/index.ts deleted file mode 100644 index f77402c..0000000 --- a/owl-bot-staging/v2/src/v2/index.ts +++ /dev/null @@ -1,19 +0,0 @@ -// Copyright 2022 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 {ServiceControllerClient} from './service_controller_client'; diff --git a/owl-bot-staging/v2/src/v2/service_controller_client.ts b/owl-bot-staging/v2/src/v2/service_controller_client.ts deleted file mode 100644 index 4df9b46..0000000 --- a/owl-bot-staging/v2/src/v2/service_controller_client.ts +++ /dev/null @@ -1,508 +0,0 @@ -// Copyright 2022 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 * as gax from 'google-gax'; -import {Callback, CallOptions, Descriptors, ClientOptions} from 'google-gax'; - -import * as protos from '../../protos/protos'; -import jsonProtos = require('../../protos/protos.json'); -/** - * Client JSON configuration object, loaded from - * `src/v2/service_controller_client_config.json`. - * This file defines retry strategy and timeouts for all API methods in this library. - */ -import * as gapicConfig from './service_controller_client_config.json'; - -const version = require('../../../package.json').version; - -/** - * [Service Control API - * v2](https://cloud.google.com/service-infrastructure/docs/service-control/access-control) - * - * Private Preview. This feature is only available for approved services. - * - * This API provides admission control and telemetry reporting for services - * that are integrated with [Service - * Infrastructure](https://cloud.google.com/service-infrastructure). - * @class - * @memberof v2 - */ -export class ServiceControllerClient { - 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}; - serviceControllerStub?: Promise<{[name: string]: Function}>; - - /** - * Construct an instance of ServiceControllerClient. - * - * @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}. - */ - constructor(opts?: ClientOptions) { - // Ensure that options include all the required fields. - const staticMembers = this.constructor as typeof ServiceControllerClient; - 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); - - // 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; - } - - // Choose either gRPC or proto-over-HTTP implementation of google-gax. - this._gaxModule = opts.fallback ? gax.fallback : gax; - - // 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); - - // Put together the default options sent with requests. - this._defaults = this._gaxGrpc.constructSettings( - 'google.api.servicecontrol.v2.ServiceController', 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 = gax.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.serviceControllerStub) { - return this.serviceControllerStub; - } - - // Put together the "service stub" for - // google.api.servicecontrol.v2.ServiceController. - this.serviceControllerStub = this._gaxGrpc.createStub( - this._opts.fallback ? - (this._protos as protobuf.Root).lookupService('google.api.servicecontrol.v2.ServiceController') : - // eslint-disable-next-line @typescript-eslint/no-explicit-any - (this._protos as any).google.api.servicecontrol.v2.ServiceController, - 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 serviceControllerStubMethods = - ['check', 'report']; - for (const methodName of serviceControllerStubMethods) { - const callPromise = this.serviceControllerStub.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 = - undefined; - const apiCall = this._gaxModule.createApiCall( - callPromise, - this._defaults[methodName], - descriptor - ); - - this.innerApiCalls[methodName] = apiCall; - } - - return this.serviceControllerStub; - } - - /** - * The DNS address for this API service. - * @returns {string} The DNS address for this service. - */ - static get servicePath() { - return 'servicecontrol.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 'servicecontrol.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/cloud-platform', - 'https://www.googleapis.com/auth/servicecontrol' - ]; - } - - 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 -- - // ------------------- -/** - * Private Preview. This feature is only available for approved services. - * - * This method provides admission control for services that are integrated - * with [Service - * Infrastructure](https://cloud.google.com/service-infrastructure). It checks - * whether an operation should be allowed based on the service configuration - * and relevant policies. It must be called before the operation is executed. - * For more information, see - * [Admission - * Control](https://cloud.google.com/service-infrastructure/docs/admission-control). - * - * NOTE: The admission control has an expected policy propagation delay of - * 60s. The caller **must** not depend on the most recent policy changes. - * - * NOTE: The admission control has a hard limit of 1 referenced resources - * per call. If an operation refers to more than 1 resources, the caller - * must call the Check method multiple times. - * - * This method requires the `servicemanagement.services.check` permission - * on the specified service. For more information, see - * [Service Control API Access - * Control](https://cloud.google.com/service-infrastructure/docs/service-control/access-control). - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.serviceName - * The service name as specified in its service configuration. For example, - * `"pubsub.googleapis.com"`. - * - * See - * [google.api.Service](https://cloud.google.com/service-management/reference/rpc/google.api#google.api.Service) - * for the definition of a service name. - * @param {string} request.serviceConfigId - * Specifies the version of the service configuration that should be used to - * process the request. Must not be empty. Set this field to 'latest' to - * specify using the latest configuration. - * @param {google.rpc.context.AttributeContext} request.attributes - * Describes attributes about the operation being executed by the service. - * @param {number[]} request.resources - * Describes the resources and the policies applied to each resource. - * @param {string} request.flags - * Optional. Contains a comma-separated list of flags. - * @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 [CheckResponse]{@link google.api.servicecontrol.v2.CheckResponse}. - * 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/v2/service_controller.check.js - * region_tag:servicecontrol_v2_generated_ServiceController_Check_async - */ - check( - request?: protos.google.api.servicecontrol.v2.ICheckRequest, - options?: CallOptions): - Promise<[ - protos.google.api.servicecontrol.v2.ICheckResponse, - protos.google.api.servicecontrol.v2.ICheckRequest|undefined, {}|undefined - ]>; - check( - request: protos.google.api.servicecontrol.v2.ICheckRequest, - options: CallOptions, - callback: Callback< - protos.google.api.servicecontrol.v2.ICheckResponse, - protos.google.api.servicecontrol.v2.ICheckRequest|null|undefined, - {}|null|undefined>): void; - check( - request: protos.google.api.servicecontrol.v2.ICheckRequest, - callback: Callback< - protos.google.api.servicecontrol.v2.ICheckResponse, - protos.google.api.servicecontrol.v2.ICheckRequest|null|undefined, - {}|null|undefined>): void; - check( - request?: protos.google.api.servicecontrol.v2.ICheckRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.api.servicecontrol.v2.ICheckResponse, - protos.google.api.servicecontrol.v2.ICheckRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.api.servicecontrol.v2.ICheckResponse, - protos.google.api.servicecontrol.v2.ICheckRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.api.servicecontrol.v2.ICheckResponse, - protos.google.api.servicecontrol.v2.ICheckRequest|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' - ] = gax.routingHeader.fromParams({ - 'service_name': request.serviceName || '', - }); - this.initialize(); - return this.innerApiCalls.check(request, options, callback); - } -/** - * Private Preview. This feature is only available for approved services. - * - * This method provides telemetry reporting for services that are integrated - * with [Service - * Infrastructure](https://cloud.google.com/service-infrastructure). It - * reports a list of operations that have occurred on a service. It must be - * called after the operations have been executed. For more information, see - * [Telemetry - * Reporting](https://cloud.google.com/service-infrastructure/docs/telemetry-reporting). - * - * NOTE: The telemetry reporting has a hard limit of 1000 operations and 1MB - * per Report call. It is recommended to have no more than 100 operations per - * call. - * - * This method requires the `servicemanagement.services.report` permission - * on the specified service. For more information, see - * [Service Control API Access - * Control](https://cloud.google.com/service-infrastructure/docs/service-control/access-control). - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.serviceName - * The service name as specified in its service configuration. For example, - * `"pubsub.googleapis.com"`. - * - * See - * [google.api.Service](https://cloud.google.com/service-management/reference/rpc/google.api#google.api.Service) - * for the definition of a service name. - * @param {string} request.serviceConfigId - * Specifies the version of the service configuration that should be used to - * process the request. Must not be empty. Set this field to 'latest' to - * specify using the latest configuration. - * @param {number[]} request.operations - * Describes the list of operations to be reported. Each operation is - * represented as an AttributeContext, and contains all attributes around an - * API access. - * @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 [ReportResponse]{@link google.api.servicecontrol.v2.ReportResponse}. - * 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/v2/service_controller.report.js - * region_tag:servicecontrol_v2_generated_ServiceController_Report_async - */ - report( - request?: protos.google.api.servicecontrol.v2.IReportRequest, - options?: CallOptions): - Promise<[ - protos.google.api.servicecontrol.v2.IReportResponse, - protos.google.api.servicecontrol.v2.IReportRequest|undefined, {}|undefined - ]>; - report( - request: protos.google.api.servicecontrol.v2.IReportRequest, - options: CallOptions, - callback: Callback< - protos.google.api.servicecontrol.v2.IReportResponse, - protos.google.api.servicecontrol.v2.IReportRequest|null|undefined, - {}|null|undefined>): void; - report( - request: protos.google.api.servicecontrol.v2.IReportRequest, - callback: Callback< - protos.google.api.servicecontrol.v2.IReportResponse, - protos.google.api.servicecontrol.v2.IReportRequest|null|undefined, - {}|null|undefined>): void; - report( - request?: protos.google.api.servicecontrol.v2.IReportRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.api.servicecontrol.v2.IReportResponse, - protos.google.api.servicecontrol.v2.IReportRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.api.servicecontrol.v2.IReportResponse, - protos.google.api.servicecontrol.v2.IReportRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.api.servicecontrol.v2.IReportResponse, - protos.google.api.servicecontrol.v2.IReportRequest|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' - ] = gax.routingHeader.fromParams({ - 'service_name': request.serviceName || '', - }); - this.initialize(); - return this.innerApiCalls.report(request, options, callback); - } - - - /** - * 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.serviceControllerStub && !this._terminated) { - return this.serviceControllerStub.then(stub => { - this._terminated = true; - stub.close(); - }); - } - return Promise.resolve(); - } -} diff --git a/owl-bot-staging/v2/src/v2/service_controller_client_config.json b/owl-bot-staging/v2/src/v2/service_controller_client_config.json deleted file mode 100644 index eb8eeeb..0000000 --- a/owl-bot-staging/v2/src/v2/service_controller_client_config.json +++ /dev/null @@ -1,47 +0,0 @@ -{ - "interfaces": { - "google.api.servicecontrol.v2.ServiceController": { - "retry_codes": { - "non_idempotent": [], - "idempotent": [ - "DEADLINE_EXCEEDED", - "UNAVAILABLE" - ], - "unavailable": [ - "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 - }, - "ce5b960a6ed052e690863808e4f0deff3dc7d49f": { - "initial_retry_delay_millis": 1000, - "retry_delay_multiplier": 1.3, - "max_retry_delay_millis": 10000, - "initial_rpc_timeout_millis": 60000, - "rpc_timeout_multiplier": 1, - "max_rpc_timeout_millis": 60000, - "total_timeout_millis": 600000 - } - }, - "methods": { - "Check": { - "timeout_millis": 5000, - "retry_codes_name": "unavailable", - "retry_params_name": "ce5b960a6ed052e690863808e4f0deff3dc7d49f" - }, - "Report": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - } - } - } - } -} diff --git a/owl-bot-staging/v2/src/v2/service_controller_proto_list.json b/owl-bot-staging/v2/src/v2/service_controller_proto_list.json deleted file mode 100644 index dda310a..0000000 --- a/owl-bot-staging/v2/src/v2/service_controller_proto_list.json +++ /dev/null @@ -1,3 +0,0 @@ -[ - "../../protos/google/api/servicecontrol/v2/service_controller.proto" -] diff --git a/owl-bot-staging/v2/system-test/fixtures/sample/src/index.js b/owl-bot-staging/v2/system-test/fixtures/sample/src/index.js deleted file mode 100644 index f8c9135..0000000 --- a/owl-bot-staging/v2/system-test/fixtures/sample/src/index.js +++ /dev/null @@ -1,27 +0,0 @@ -// Copyright 2022 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 servicecontrol = require('@google-cloud/servicecontrol'); - -function main() { - const serviceControllerClient = new servicecontrol.ServiceControllerClient(); -} - -main(); diff --git a/owl-bot-staging/v2/system-test/fixtures/sample/src/index.ts b/owl-bot-staging/v2/system-test/fixtures/sample/src/index.ts deleted file mode 100644 index 9750f7b..0000000 --- a/owl-bot-staging/v2/system-test/fixtures/sample/src/index.ts +++ /dev/null @@ -1,32 +0,0 @@ -// Copyright 2022 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 {ServiceControllerClient} from '@google-cloud/servicecontrol'; - -// check that the client class type name can be used -function doStuffWithServiceControllerClient(client: ServiceControllerClient) { - client.close(); -} - -function main() { - // check that the client instance can be created - const serviceControllerClient = new ServiceControllerClient(); - doStuffWithServiceControllerClient(serviceControllerClient); -} - -main(); diff --git a/owl-bot-staging/v2/system-test/install.ts b/owl-bot-staging/v2/system-test/install.ts deleted file mode 100644 index 8ec4522..0000000 --- a/owl-bot-staging/v2/system-test/install.ts +++ /dev/null @@ -1,49 +0,0 @@ -// Copyright 2022 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/v2/test/gapic_service_controller_v2.ts b/owl-bot-staging/v2/test/gapic_service_controller_v2.ts deleted file mode 100644 index d7f03ed..0000000 --- a/owl-bot-staging/v2/test/gapic_service_controller_v2.ts +++ /dev/null @@ -1,329 +0,0 @@ -// Copyright 2022 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 servicecontrollerModule from '../src'; - -import {protobuf} from 'google-gax'; - -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); -} - -describe('v2.ServiceControllerClient', () => { - it('has servicePath', () => { - const servicePath = servicecontrollerModule.v2.ServiceControllerClient.servicePath; - assert(servicePath); - }); - - it('has apiEndpoint', () => { - const apiEndpoint = servicecontrollerModule.v2.ServiceControllerClient.apiEndpoint; - assert(apiEndpoint); - }); - - it('has port', () => { - const port = servicecontrollerModule.v2.ServiceControllerClient.port; - assert(port); - assert(typeof port === 'number'); - }); - - it('should create a client with no option', () => { - const client = new servicecontrollerModule.v2.ServiceControllerClient(); - assert(client); - }); - - it('should create a client with gRPC fallback', () => { - const client = new servicecontrollerModule.v2.ServiceControllerClient({ - fallback: true, - }); - assert(client); - }); - - it('has initialize method and supports deferred initialization', async () => { - const client = new servicecontrollerModule.v2.ServiceControllerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - assert.strictEqual(client.serviceControllerStub, undefined); - await client.initialize(); - assert(client.serviceControllerStub); - }); - - it('has close method for the initialized client', done => { - const client = new servicecontrollerModule.v2.ServiceControllerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - assert(client.serviceControllerStub); - client.close().then(() => { - done(); - }); - }); - - it('has close method for the non-initialized client', done => { - const client = new servicecontrollerModule.v2.ServiceControllerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - assert.strictEqual(client.serviceControllerStub, undefined); - client.close().then(() => { - done(); - }); - }); - - it('has getProjectId method', async () => { - const fakeProjectId = 'fake-project-id'; - const client = new servicecontrollerModule.v2.ServiceControllerClient({ - 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 servicecontrollerModule.v2.ServiceControllerClient({ - 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('check', () => { - it('invokes check without error', async () => { - const client = new servicecontrollerModule.v2.ServiceControllerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.api.servicecontrol.v2.CheckRequest()); - request.serviceName = ''; - const expectedHeaderRequestParams = "service_name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.api.servicecontrol.v2.CheckResponse()); - client.innerApiCalls.check = stubSimpleCall(expectedResponse); - const [response] = await client.check(request); - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.check as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes check without error using callback', async () => { - const client = new servicecontrollerModule.v2.ServiceControllerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.api.servicecontrol.v2.CheckRequest()); - request.serviceName = ''; - const expectedHeaderRequestParams = "service_name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.api.servicecontrol.v2.CheckResponse()); - client.innerApiCalls.check = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.check( - request, - (err?: Error|null, result?: protos.google.api.servicecontrol.v2.ICheckResponse|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.check as SinonStub) - .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); - }); - - it('invokes check with error', async () => { - const client = new servicecontrollerModule.v2.ServiceControllerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.api.servicecontrol.v2.CheckRequest()); - request.serviceName = ''; - const expectedHeaderRequestParams = "service_name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.innerApiCalls.check = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.check(request), expectedError); - assert((client.innerApiCalls.check as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes check with closed client', async () => { - const client = new servicecontrollerModule.v2.ServiceControllerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.api.servicecontrol.v2.CheckRequest()); - request.serviceName = ''; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.check(request), expectedError); - }); - }); - - describe('report', () => { - it('invokes report without error', async () => { - const client = new servicecontrollerModule.v2.ServiceControllerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.api.servicecontrol.v2.ReportRequest()); - request.serviceName = ''; - const expectedHeaderRequestParams = "service_name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.api.servicecontrol.v2.ReportResponse()); - client.innerApiCalls.report = stubSimpleCall(expectedResponse); - const [response] = await client.report(request); - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.report as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes report without error using callback', async () => { - const client = new servicecontrollerModule.v2.ServiceControllerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.api.servicecontrol.v2.ReportRequest()); - request.serviceName = ''; - const expectedHeaderRequestParams = "service_name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.api.servicecontrol.v2.ReportResponse()); - client.innerApiCalls.report = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.report( - request, - (err?: Error|null, result?: protos.google.api.servicecontrol.v2.IReportResponse|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.report as SinonStub) - .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); - }); - - it('invokes report with error', async () => { - const client = new servicecontrollerModule.v2.ServiceControllerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.api.servicecontrol.v2.ReportRequest()); - request.serviceName = ''; - const expectedHeaderRequestParams = "service_name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.innerApiCalls.report = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.report(request), expectedError); - assert((client.innerApiCalls.report as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes report with closed client', async () => { - const client = new servicecontrollerModule.v2.ServiceControllerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.api.servicecontrol.v2.ReportRequest()); - request.serviceName = ''; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.report(request), expectedError); - }); - }); -}); diff --git a/owl-bot-staging/v2/tsconfig.json b/owl-bot-staging/v2/tsconfig.json deleted file mode 100644 index c78f1c8..0000000 --- a/owl-bot-staging/v2/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/v2/webpack.config.js b/owl-bot-staging/v2/webpack.config.js deleted file mode 100644 index 54d59d9..0000000 --- a/owl-bot-staging/v2/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: 'ServiceController', - filename: './service-controller.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/src/v1/quota_controller_client.ts b/src/v1/quota_controller_client.ts index ca87645..3053fc6 100644 --- a/src/v1/quota_controller_client.ts +++ b/src/v1/quota_controller_client.ts @@ -63,7 +63,7 @@ export class QuotaControllerClient { * * @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/master/client-libraries.md#creating-the-client-instance). + * 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] @@ -86,11 +86,10 @@ export class QuotaControllerClient { * API remote host. * @param {gax.ClientConfig} [options.clientConfig] - Client configuration override. * Follows the structure of {@link gapicConfig}. - * @param {boolean} [options.fallback] - Use HTTP fallback mode. - * In fallback mode, a special browser-compatible transport implementation is used - * instead of gRPC transport. In browser context (if the `window` object is defined) - * the fallback mode is enabled automatically; set `options.fallback` to `false` - * if you need to override this behavior. + * @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}. */ constructor(opts?: ClientOptions) { // Ensure that options include all the required fields. diff --git a/src/v1/service_controller_client.ts b/src/v1/service_controller_client.ts index 5d6e626..7c0d456 100644 --- a/src/v1/service_controller_client.ts +++ b/src/v1/service_controller_client.ts @@ -63,7 +63,7 @@ export class ServiceControllerClient { * * @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/master/client-libraries.md#creating-the-client-instance). + * 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] @@ -86,11 +86,10 @@ export class ServiceControllerClient { * API remote host. * @param {gax.ClientConfig} [options.clientConfig] - Client configuration override. * Follows the structure of {@link gapicConfig}. - * @param {boolean} [options.fallback] - Use HTTP fallback mode. - * In fallback mode, a special browser-compatible transport implementation is used - * instead of gRPC transport. In browser context (if the `window` object is defined) - * the fallback mode is enabled automatically; set `options.fallback` to `false` - * if you need to override this behavior. + * @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}. */ constructor(opts?: ClientOptions) { // Ensure that options include all the required fields. diff --git a/src/v2/service_controller_client.ts b/src/v2/service_controller_client.ts index 6eac0e7..e8782dd 100644 --- a/src/v2/service_controller_client.ts +++ b/src/v2/service_controller_client.ts @@ -67,7 +67,7 @@ export class ServiceControllerClient { * * @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/master/client-libraries.md#creating-the-client-instance). + * 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] @@ -90,11 +90,10 @@ export class ServiceControllerClient { * API remote host. * @param {gax.ClientConfig} [options.clientConfig] - Client configuration override. * Follows the structure of {@link gapicConfig}. - * @param {boolean} [options.fallback] - Use HTTP fallback mode. - * In fallback mode, a special browser-compatible transport implementation is used - * instead of gRPC transport. In browser context (if the `window` object is defined) - * the fallback mode is enabled automatically; set `options.fallback` to `false` - * if you need to override this behavior. + * @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}. */ constructor(opts?: ClientOptions) { // Ensure that options include all the required fields.